bobby 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +33 -0
- data/Gemfile +41 -0
- data/LICENSE +20 -0
- data/README.rdoc +113 -0
- data/Rakefile +58 -0
- data/VERSION +1 -0
- data/bobby.gemspec +65 -0
- data/features/bobby.feature +9 -0
- data/features/step_definitions/bobby_steps.rb +0 -0
- data/features/support/env.rb +4 -0
- data/lib/bobby.rb +0 -0
- data/spec/bobby_spec.rb +7 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +9 -0
- data/test/performance/browsing_test.rb +9 -0
- data/test/test_helper.rb +13 -0
- metadata +118 -0
data/.document
ADDED
data/.gitignore
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
## MAC OS
|
2
|
+
.DS_Store
|
3
|
+
|
4
|
+
## TEXTMATE
|
5
|
+
*.tmproj
|
6
|
+
tmtags
|
7
|
+
|
8
|
+
## EMACS
|
9
|
+
*~
|
10
|
+
\#*
|
11
|
+
.\#*
|
12
|
+
|
13
|
+
## VIM
|
14
|
+
*.swp
|
15
|
+
|
16
|
+
## PROJECT::GENERAL
|
17
|
+
coverage
|
18
|
+
rdoc
|
19
|
+
pkg
|
20
|
+
|
21
|
+
## PROJECT::SPECIFIC
|
22
|
+
.bundle
|
23
|
+
app
|
24
|
+
config
|
25
|
+
config.ru
|
26
|
+
db
|
27
|
+
doc
|
28
|
+
log
|
29
|
+
public
|
30
|
+
script
|
31
|
+
test
|
32
|
+
tmp
|
33
|
+
vendor
|
data/Gemfile
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
source :gemcutter
|
2
|
+
source "http://rubygems.org"
|
3
|
+
|
4
|
+
gem 'rails', '3.0.0.beta4'
|
5
|
+
|
6
|
+
# Bundle edge Rails instead:
|
7
|
+
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
8
|
+
|
9
|
+
gem 'sqlite3-ruby', :require => 'sqlite3'
|
10
|
+
|
11
|
+
# Use unicorn as the web server
|
12
|
+
# gem 'unicorn'
|
13
|
+
|
14
|
+
# Deploy with Capistrano
|
15
|
+
# gem 'capistrano'
|
16
|
+
|
17
|
+
# To use debugger
|
18
|
+
# gem 'ruby-debug'
|
19
|
+
|
20
|
+
# Bundle the extra gems:
|
21
|
+
# gem 'bj'
|
22
|
+
# gem 'nokogiri', '1.4.1'
|
23
|
+
# gem 'aws-s3', :require => 'aws/s3'
|
24
|
+
|
25
|
+
# Bundle gems for certain environments:
|
26
|
+
# gem 'rspec', :group => :test
|
27
|
+
# group :test do
|
28
|
+
# gem 'webrat'
|
29
|
+
# end
|
30
|
+
|
31
|
+
|
32
|
+
#gem 'rails', :path => "./vendor/rails"
|
33
|
+
|
34
|
+
gem "rspec-rails", ">= 2.0.0.beta.17"
|
35
|
+
gem 'rspec'
|
36
|
+
|
37
|
+
gem 'cucumber'
|
38
|
+
gem 'cucumber-rails'
|
39
|
+
gem 'aruba', ">= 0.2.0", :require => nil
|
40
|
+
gem 'jeweler'
|
41
|
+
gem 'webrat'
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Enrique Phillips
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
= Bobby
|
2
|
+
|
3
|
+
== Welcome
|
4
|
+
|
5
|
+
I choose the name paying homage to the many policemen (that would be cops to some of you)
|
6
|
+
relentlessly patroling the streets all over this cynical and moraleless world, be it
|
7
|
+
in the Big Apple or some back street in Algier.
|
8
|
+
|
9
|
+
Bobby is all about guarding access
|
10
|
+
|
11
|
+
# access to actions on controllers
|
12
|
+
# access to model instances (table rows)
|
13
|
+
|
14
|
+
CAVEAT: The data guarding is not nearly solved with Bobby - I will be the first to commit to that!
|
15
|
+
Data guarding should be enforced on a number of levels - with the encryption of data in SQL
|
16
|
+
servers being at one end of the rope, and physical access to buildings and data terminals
|
17
|
+
at the other end. Somewhere in between lays Bobby, next to considerations whether to just
|
18
|
+
guard data terminals or expand the guarding to encompass cables and network infrastructure
|
19
|
+
too! And then there is the physical world of documents, papers, letters, telephone calls
|
20
|
+
etc - well, Bobby is but a tiny piece in a much larger puzzle :)
|
21
|
+
|
22
|
+
== Waiver
|
23
|
+
|
24
|
+
Bobby is my first attempt to building a Gem and also my very first Rails project published
|
25
|
+
with Github, and (I am sorry to confessing) even my first try at TDD.
|
26
|
+
|
27
|
+
That out in the open - please don't bury me for all the wrongs I'm probably doing as I go
|
28
|
+
along <:)
|
29
|
+
|
30
|
+
== Use Cases
|
31
|
+
|
32
|
+
Bobby is my attempt to solving a small number of use cases that I have listed below:
|
33
|
+
|
34
|
+
=== Guard access to actions on controllers/models
|
35
|
+
|
36
|
+
I realize that a fair number of projects exist which provide authorisation to users but most
|
37
|
+
that I've been able to google, have focused on semi-static authorisations through some
|
38
|
+
configuration setup.
|
39
|
+
|
40
|
+
In my experience - and judging from the use cases below - authorisations of today are
|
41
|
+
fluctuating and certainly not slabbed in concrete. Delegating authorisations is at the discretion of
|
42
|
+
superiors and hardly something they will delegate to geeks in the IT department.
|
43
|
+
|
44
|
+
==== UC #1: Add an authorisation for an action on a controller to any given user
|
45
|
+
|
46
|
+
===== New apprentice in Procurement
|
47
|
+
|
48
|
+
"Carrie, the new apprentice in Procurement, will need to have access to our Supply Management System,
|
49
|
+
through the PurchaseOrdersController (PO), PurchaseReceiptsController (PR) and StockItemsController (SI). She is
|
50
|
+
authorised to list, show and insert PO's, list, show and update PR's, and list and show SI's."
|
51
|
+
|
52
|
+
==== UC #2: Temporarily allow a user access to confidential information otherwise not permitted for him to peruse
|
53
|
+
|
54
|
+
===== Internships, trainees et al
|
55
|
+
|
56
|
+
"Elisabeth, trainee and Msc student, has been granted no bars access to information in Accounting during a
|
57
|
+
three week internship with our company."
|
58
|
+
|
59
|
+
=== Guard access to model instances - rows loaded from tables
|
60
|
+
|
61
|
+
I've read through a number of ACL based projects and I guess it has to be me not being
|
62
|
+
well-educated, but I've yet to understand how to set one of them up :(
|
63
|
+
|
64
|
+
Offering an organisation access control at a granular level like row data will prove to be a true Sword of Damocles
|
65
|
+
as the organisation enjoys fine-grained access control, delegating and restricting access left and right - unknowingly
|
66
|
+
creating chaos in the general levels of auhtorisation and chain of command, eventually leading to a demand for
|
67
|
+
access control dissolution all together - 'We Need A Clean Slate' kind of job - which was entirely not what the access
|
68
|
+
control system had been setup to do in the first place!
|
69
|
+
|
70
|
+
Used wisely, in a select few places, granular access control will, however, augment a general access control
|
71
|
+
|
72
|
+
==== UC #3: New account manager in Procurement
|
73
|
+
|
74
|
+
"Carrie, the new large account manager in Procurement, will need to have access to information pertaining to our
|
75
|
+
three top suppliers, in Accounting."
|
76
|
+
|
77
|
+
==== UC #4: Strategic observations as Customer Comments
|
78
|
+
|
79
|
+
"The brass will be evaluating customer performance during the next 3 months and will add comments to each customers 'blog'.
|
80
|
+
This information is not to disseminate into the wild!"
|
81
|
+
|
82
|
+
NOTE: Arguably, this UC #4 is rather construed, but it proves the point that a certain sphere of information should be detainable
|
83
|
+
within the boundaries of some system for the benefit of a finite party of users!
|
84
|
+
|
85
|
+
== Compatibility
|
86
|
+
|
87
|
+
Bobby is a Rails 3 Gem, pre version 3 compatibility is scarce, at best!
|
88
|
+
|
89
|
+
== Requirements
|
90
|
+
|
91
|
+
== Known Bugs
|
92
|
+
|
93
|
+
== Installation
|
94
|
+
|
95
|
+
Generally, the easy way to use Bobby, is to add it to your Gemfile
|
96
|
+
|
97
|
+
gem 'bobby'
|
98
|
+
|
99
|
+
and have Bundler check/install it if necessary
|
100
|
+
|
101
|
+
== Note on Patches/Pull Requests
|
102
|
+
|
103
|
+
* Fork the project.
|
104
|
+
* Make your feature addition or bug fix.
|
105
|
+
* Add tests for it. This is important so I don't break it in a
|
106
|
+
future version unintentionally.
|
107
|
+
* Commit, do not mess with rakefile, version, or history.
|
108
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
109
|
+
* Send me a pull request. Bonus points for topic branches.
|
110
|
+
|
111
|
+
== Copyright
|
112
|
+
|
113
|
+
Copyright (c) 2010 Enrique Phillips. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "bobby"
|
8
|
+
gem.summary = %Q{Have the Ol' Bobby Tit Head take his turns at watching over the access to actions on controllers and instances of models?}
|
9
|
+
gem.description = %Q{Bobby is all about guarding the access to actions on controllers and model instances on your Rails projects, and requires you to setup some authentication
|
10
|
+
regime in advance - like Devise, Authlogic et al - with a User model, and preferably a GroupUser and GroupUsersUsers models too.}
|
11
|
+
gem.email = "enrique.phillips.wac@gmail.com"
|
12
|
+
gem.homepage = "http://github.com/ep-wac/Bobby"
|
13
|
+
gem.authors = ["Enrique Phillips"]
|
14
|
+
gem.add_development_dependency "rspec", ">= 1.2.9"
|
15
|
+
gem.add_development_dependency "cucumber", ">= 0"
|
16
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
17
|
+
end
|
18
|
+
Jeweler::GemcutterTasks.new
|
19
|
+
rescue LoadError
|
20
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
21
|
+
end
|
22
|
+
|
23
|
+
require 'spec/rake/spectask'
|
24
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
25
|
+
spec.libs << 'lib' << 'spec'
|
26
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
27
|
+
end
|
28
|
+
|
29
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
30
|
+
spec.libs << 'lib' << 'spec'
|
31
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
32
|
+
spec.rcov = true
|
33
|
+
end
|
34
|
+
|
35
|
+
task :spec => :check_dependencies
|
36
|
+
|
37
|
+
begin
|
38
|
+
require 'cucumber/rake/task'
|
39
|
+
Cucumber::Rake::Task.new(:features)
|
40
|
+
|
41
|
+
task :features => :check_dependencies
|
42
|
+
rescue LoadError
|
43
|
+
task :features do
|
44
|
+
abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
task :default => :spec
|
49
|
+
|
50
|
+
require 'rake/rdoctask'
|
51
|
+
Rake::RDocTask.new do |rdoc|
|
52
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
53
|
+
|
54
|
+
rdoc.rdoc_dir = 'rdoc'
|
55
|
+
rdoc.title = "bobby #{version}"
|
56
|
+
rdoc.rdoc_files.include('README*')
|
57
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
58
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/bobby.gemspec
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{bobby}
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Enrique Phillips"]
|
12
|
+
s.date = %q{2010-07-21}
|
13
|
+
s.description = %q{Bobby is all about guarding the access to actions on controllers and model instances on your Rails projects, and requires you to setup some authentication
|
14
|
+
regime in advance - like Devise, Authlogic et al - with a User model, and preferably a GroupUser and GroupUsersUsers models too.}
|
15
|
+
s.email = %q{enrique.phillips.wac@gmail.com}
|
16
|
+
s.extra_rdoc_files = [
|
17
|
+
"LICENSE",
|
18
|
+
"README.rdoc"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".document",
|
22
|
+
".gitignore",
|
23
|
+
"Gemfile",
|
24
|
+
"LICENSE",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"bobby.gemspec",
|
29
|
+
"features/bobby.feature",
|
30
|
+
"features/step_definitions/bobby_steps.rb",
|
31
|
+
"features/support/env.rb",
|
32
|
+
"lib/bobby.rb",
|
33
|
+
"spec/bobby_spec.rb",
|
34
|
+
"spec/spec.opts",
|
35
|
+
"spec/spec_helper.rb"
|
36
|
+
]
|
37
|
+
s.homepage = %q{http://github.com/ep-wac/Bobby}
|
38
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
39
|
+
s.require_paths = ["lib"]
|
40
|
+
s.rubygems_version = %q{1.3.7}
|
41
|
+
s.summary = %q{Have the Ol' Bobby Tit Head take his turns at watching over the access to actions on controllers and instances of models?}
|
42
|
+
s.test_files = [
|
43
|
+
"spec/bobby_spec.rb",
|
44
|
+
"spec/spec_helper.rb",
|
45
|
+
"test/performance/browsing_test.rb",
|
46
|
+
"test/test_helper.rb"
|
47
|
+
]
|
48
|
+
|
49
|
+
if s.respond_to? :specification_version then
|
50
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
51
|
+
s.specification_version = 3
|
52
|
+
|
53
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
54
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
55
|
+
s.add_development_dependency(%q<cucumber>, [">= 0"])
|
56
|
+
else
|
57
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
58
|
+
s.add_dependency(%q<cucumber>, [">= 0"])
|
59
|
+
end
|
60
|
+
else
|
61
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
62
|
+
s.add_dependency(%q<cucumber>, [">= 0"])
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
File without changes
|
data/lib/bobby.rb
ADDED
File without changes
|
data/spec/bobby_spec.rb
ADDED
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
ADDED
data/test/test_helper.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
|
+
require File.expand_path('../../config/environment', __FILE__)
|
3
|
+
require 'rails/test_help'
|
4
|
+
|
5
|
+
class ActiveSupport::TestCase
|
6
|
+
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
7
|
+
#
|
8
|
+
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
9
|
+
# -- they do not yet inherit this setting
|
10
|
+
fixtures :all
|
11
|
+
|
12
|
+
# Add more helper methods to be used by all tests here...
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bobby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Enrique Phillips
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-07-21 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rspec
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 13
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 2
|
33
|
+
- 9
|
34
|
+
version: 1.2.9
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: cucumber
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
version: "0"
|
49
|
+
type: :development
|
50
|
+
version_requirements: *id002
|
51
|
+
description: |-
|
52
|
+
Bobby is all about guarding the access to actions on controllers and model instances on your Rails projects, and requires you to setup some authentication
|
53
|
+
regime in advance - like Devise, Authlogic et al - with a User model, and preferably a GroupUser and GroupUsersUsers models too.
|
54
|
+
email: enrique.phillips.wac@gmail.com
|
55
|
+
executables: []
|
56
|
+
|
57
|
+
extensions: []
|
58
|
+
|
59
|
+
extra_rdoc_files:
|
60
|
+
- LICENSE
|
61
|
+
- README.rdoc
|
62
|
+
files:
|
63
|
+
- .document
|
64
|
+
- .gitignore
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE
|
67
|
+
- README.rdoc
|
68
|
+
- Rakefile
|
69
|
+
- VERSION
|
70
|
+
- bobby.gemspec
|
71
|
+
- features/bobby.feature
|
72
|
+
- features/step_definitions/bobby_steps.rb
|
73
|
+
- features/support/env.rb
|
74
|
+
- lib/bobby.rb
|
75
|
+
- spec/bobby_spec.rb
|
76
|
+
- spec/spec.opts
|
77
|
+
- spec/spec_helper.rb
|
78
|
+
- test/performance/browsing_test.rb
|
79
|
+
- test/test_helper.rb
|
80
|
+
has_rdoc: true
|
81
|
+
homepage: http://github.com/ep-wac/Bobby
|
82
|
+
licenses: []
|
83
|
+
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options:
|
86
|
+
- --charset=UTF-8
|
87
|
+
require_paths:
|
88
|
+
- lib
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
hash: 3
|
95
|
+
segments:
|
96
|
+
- 0
|
97
|
+
version: "0"
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
hash: 3
|
104
|
+
segments:
|
105
|
+
- 0
|
106
|
+
version: "0"
|
107
|
+
requirements: []
|
108
|
+
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 1.3.7
|
111
|
+
signing_key:
|
112
|
+
specification_version: 3
|
113
|
+
summary: Have the Ol' Bobby Tit Head take his turns at watching over the access to actions on controllers and instances of models?
|
114
|
+
test_files:
|
115
|
+
- spec/bobby_spec.rb
|
116
|
+
- spec/spec_helper.rb
|
117
|
+
- test/performance/browsing_test.rb
|
118
|
+
- test/test_helper.rb
|