rurounijones-acl9 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.textile +28 -0
- data/MIT-LICENSE +20 -0
- data/README.textile +891 -0
- data/Rakefile +39 -0
- data/TODO +42 -0
- data/VERSION.yml +4 -0
- data/lib/acl9.rb +16 -0
- data/lib/acl9/config.rb +9 -0
- data/lib/acl9/controller_extensions.rb +85 -0
- data/lib/acl9/controller_extensions/dsl_base.rb +229 -0
- data/lib/acl9/controller_extensions/generators.rb +197 -0
- data/lib/acl9/helpers.rb +19 -0
- data/lib/acl9/model_extensions.rb +111 -0
- data/lib/acl9/model_extensions/object.rb +59 -0
- data/lib/acl9/model_extensions/subject.rb +148 -0
- data/test/access_control_test.rb +338 -0
- data/test/dsl_base_test.rb +758 -0
- data/test/helpers_test.rb +93 -0
- data/test/roles_test.rb +293 -0
- data/test/support/controllers.rb +207 -0
- data/test/support/models.rb +47 -0
- data/test/support/schema.rb +69 -0
- data/test/test_helper.rb +27 -0
- metadata +102 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
class Role < ActiveRecord::Base
|
2
|
+
acts_as_authorization_role
|
3
|
+
end
|
4
|
+
|
5
|
+
class User < ActiveRecord::Base
|
6
|
+
acts_as_authorization_subject
|
7
|
+
end
|
8
|
+
|
9
|
+
class Foo < ActiveRecord::Base
|
10
|
+
acts_as_authorization_object
|
11
|
+
end
|
12
|
+
|
13
|
+
class Bar < ActiveRecord::Base
|
14
|
+
acts_as_authorization_object
|
15
|
+
end
|
16
|
+
|
17
|
+
class AnotherSubject < ActiveRecord::Base
|
18
|
+
acts_as_authorization_subject :role_class_name => 'AnotherRole'
|
19
|
+
end
|
20
|
+
|
21
|
+
class AnotherRole < ActiveRecord::Base
|
22
|
+
acts_as_authorization_role :subject_class_name => "AnotherSubject"
|
23
|
+
end
|
24
|
+
|
25
|
+
class FooBar < ActiveRecord::Base
|
26
|
+
acts_as_authorization_object :role_class_name => 'AnotherRole', :subject_class_name => "AnotherSubject"
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
module Other
|
31
|
+
|
32
|
+
class Other::User < ActiveRecord::Base
|
33
|
+
set_table_name "other_users"
|
34
|
+
acts_as_authorization_subject :join_table_name => "other_roles_other_users", :role_class_name => "Other::Role"
|
35
|
+
end
|
36
|
+
|
37
|
+
class Other::Role < ActiveRecord::Base
|
38
|
+
set_table_name "other_roles"
|
39
|
+
acts_as_authorization_role :join_table_name => "other_roles_other_users", :subject_class_name => "Other::User"
|
40
|
+
end
|
41
|
+
|
42
|
+
class Other::FooBar < ActiveRecord::Base
|
43
|
+
set_table_name "other_foo_bars"
|
44
|
+
acts_as_authorization_object :role_class_name => 'Other::Role', :subject_class_name => "Other::User"
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
ActiveRecord::Schema.define(:version => 0) do
|
2
|
+
create_table "roles", :force => true do |t|
|
3
|
+
t.string "name", :limit => 40
|
4
|
+
t.string "authorizable_type", :limit => 40
|
5
|
+
t.integer "authorizable_id"
|
6
|
+
t.datetime "created_at"
|
7
|
+
t.datetime "updated_at"
|
8
|
+
end
|
9
|
+
|
10
|
+
create_table "another_roles", :force => true do |t|
|
11
|
+
t.string "name", :limit => 40
|
12
|
+
t.string "authorizable_type", :limit => 40
|
13
|
+
t.integer "authorizable_id"
|
14
|
+
t.datetime "created_at"
|
15
|
+
t.datetime "updated_at"
|
16
|
+
end
|
17
|
+
|
18
|
+
create_table "users", :force => true do |t| end
|
19
|
+
create_table "another_subjects", :force => true do |t| end
|
20
|
+
|
21
|
+
create_table "roles_users", :id => false, :force => true do |t|
|
22
|
+
t.integer "user_id"
|
23
|
+
t.integer "role_id"
|
24
|
+
t.datetime "created_at"
|
25
|
+
t.datetime "updated_at"
|
26
|
+
end
|
27
|
+
|
28
|
+
create_table "another_roles_another_subjects", :id => false, :force => true do |t|
|
29
|
+
t.integer "another_subject_id"
|
30
|
+
t.integer "another_role_id"
|
31
|
+
t.datetime "created_at"
|
32
|
+
t.datetime "updated_at"
|
33
|
+
end
|
34
|
+
create_table "foos", :force => true do |t|
|
35
|
+
t.datetime "created_at"
|
36
|
+
t.datetime "updated_at"
|
37
|
+
end
|
38
|
+
|
39
|
+
create_table "bars", :force => true do |t|
|
40
|
+
t.datetime "created_at"
|
41
|
+
t.datetime "updated_at"
|
42
|
+
end
|
43
|
+
create_table "foo_bars", :force => true do |t|
|
44
|
+
t.datetime "created_at"
|
45
|
+
t.datetime "updated_at"
|
46
|
+
end
|
47
|
+
|
48
|
+
# namespaced
|
49
|
+
|
50
|
+
create_table "other_roles", :force => true do |t|
|
51
|
+
t.string "name", :limit => 40
|
52
|
+
t.string "authorizable_type", :limit => 40
|
53
|
+
t.integer "authorizable_id"
|
54
|
+
t.datetime "created_at"
|
55
|
+
t.datetime "updated_at"
|
56
|
+
end
|
57
|
+
create_table "other_users", :force => true do |t| end
|
58
|
+
create_table "other_roles_other_users", :id => false, :force => true do |t|
|
59
|
+
t.integer "user_id"
|
60
|
+
t.integer "role_id"
|
61
|
+
t.datetime "created_at"
|
62
|
+
t.datetime "updated_at"
|
63
|
+
end
|
64
|
+
create_table "other_foo_bars", :force => true do |t|
|
65
|
+
t.datetime "created_at"
|
66
|
+
t.datetime "updated_at"
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'test/unit'
|
3
|
+
require 'context'
|
4
|
+
require 'matchy'
|
5
|
+
require 'active_support'
|
6
|
+
require 'active_record'
|
7
|
+
require 'action_controller'
|
8
|
+
require 'action_controller/test_process'
|
9
|
+
|
10
|
+
ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :dbfile => 'test.sqlite3')
|
11
|
+
|
12
|
+
class Test::Unit::TestCase
|
13
|
+
custom_matcher :be_false do |receiver, matcher, args|
|
14
|
+
!receiver
|
15
|
+
end
|
16
|
+
|
17
|
+
custom_matcher :be_true do |receiver, matcher, args|
|
18
|
+
!!receiver
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
ActionController::Routing::Routes.draw do |map|
|
23
|
+
map.connect ":controller/:action/:id"
|
24
|
+
end
|
25
|
+
|
26
|
+
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
|
27
|
+
ActionController::Base.logger = ActiveRecord::Base.logger
|
metadata
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rurounijones-acl9
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.10.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- oleg dashevskii
|
8
|
+
- jeffrey jones
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2009-05-03 00:00:00 -07:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: jeremymcanally-context
|
18
|
+
type: :development
|
19
|
+
version_requirement:
|
20
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.5.5
|
25
|
+
version:
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: jnunemaker-matchy
|
28
|
+
type: :development
|
29
|
+
version_requirement:
|
30
|
+
version_requirements: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.4.0
|
35
|
+
version:
|
36
|
+
description: Role-based authorization system for Rails with a nice DSL for access control lists
|
37
|
+
email: jeff@jones.be
|
38
|
+
executables: []
|
39
|
+
|
40
|
+
extensions: []
|
41
|
+
|
42
|
+
extra_rdoc_files:
|
43
|
+
- README.textile
|
44
|
+
files:
|
45
|
+
- CHANGELOG.textile
|
46
|
+
- MIT-LICENSE
|
47
|
+
- README.textile
|
48
|
+
- Rakefile
|
49
|
+
- TODO
|
50
|
+
- VERSION.yml
|
51
|
+
- lib/acl9.rb
|
52
|
+
- lib/acl9/config.rb
|
53
|
+
- lib/acl9/controller_extensions.rb
|
54
|
+
- lib/acl9/controller_extensions/dsl_base.rb
|
55
|
+
- lib/acl9/controller_extensions/generators.rb
|
56
|
+
- lib/acl9/helpers.rb
|
57
|
+
- lib/acl9/model_extensions.rb
|
58
|
+
- lib/acl9/model_extensions/object.rb
|
59
|
+
- lib/acl9/model_extensions/subject.rb
|
60
|
+
- test/access_control_test.rb
|
61
|
+
- test/dsl_base_test.rb
|
62
|
+
- test/helpers_test.rb
|
63
|
+
- test/roles_test.rb
|
64
|
+
- test/support/controllers.rb
|
65
|
+
- test/support/models.rb
|
66
|
+
- test/support/schema.rb
|
67
|
+
- test/test_helper.rb
|
68
|
+
has_rdoc: true
|
69
|
+
homepage: http://github.com/rurounijones/acl9
|
70
|
+
post_install_message:
|
71
|
+
rdoc_options:
|
72
|
+
- --charset=UTF-8
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: "0"
|
80
|
+
version:
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: "0"
|
86
|
+
version:
|
87
|
+
requirements: []
|
88
|
+
|
89
|
+
rubyforge_project:
|
90
|
+
rubygems_version: 1.2.0
|
91
|
+
signing_key:
|
92
|
+
specification_version: 3
|
93
|
+
summary: Yet another role-based authorization system for Rails
|
94
|
+
test_files:
|
95
|
+
- test/helpers_test.rb
|
96
|
+
- test/support/schema.rb
|
97
|
+
- test/support/models.rb
|
98
|
+
- test/support/controllers.rb
|
99
|
+
- test/dsl_base_test.rb
|
100
|
+
- test/access_control_test.rb
|
101
|
+
- test/test_helper.rb
|
102
|
+
- test/roles_test.rb
|