acl9 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.textile +32 -0
- data/MIT-LICENSE +20 -0
- data/README.textile +888 -0
- data/Rakefile +40 -0
- data/TODO +42 -0
- data/VERSION.yml +4 -0
- data/lib/acl9.rb +16 -0
- data/lib/acl9/config.rb +10 -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 +133 -0
- data/lib/acl9/model_extensions/object.rb +59 -0
- data/lib/acl9/model_extensions/subject.rb +175 -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 +310 -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 +31 -0
- metadata +103 -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,31 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
gem 'jnunemaker-matchy', '>= 0.4.0'
|
4
|
+
gem 'jeremymcanally-context', '>= 0.5.5'
|
5
|
+
|
6
|
+
require 'test/unit'
|
7
|
+
require 'context'
|
8
|
+
require 'matchy'
|
9
|
+
require 'active_support'
|
10
|
+
require 'active_record'
|
11
|
+
require 'action_controller'
|
12
|
+
require 'action_controller/test_process'
|
13
|
+
|
14
|
+
ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :dbfile => 'test.sqlite3')
|
15
|
+
|
16
|
+
class Test::Unit::TestCase
|
17
|
+
custom_matcher :be_false do |receiver, matcher, args|
|
18
|
+
!receiver
|
19
|
+
end
|
20
|
+
|
21
|
+
custom_matcher :be_true do |receiver, matcher, args|
|
22
|
+
!!receiver
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
ActionController::Routing::Routes.draw do |map|
|
27
|
+
map.connect ":controller/:action/:id"
|
28
|
+
end
|
29
|
+
|
30
|
+
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
|
31
|
+
ActionController::Base.logger = ActiveRecord::Base.logger
|
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: acl9
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.11.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- oleg dashevskii
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-10-10 00:00:00 +07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: jeremymcanally-context
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.5.5
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: jnunemaker-matchy
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.4.0
|
34
|
+
version:
|
35
|
+
description: Role-based authorization system for Rails with a nice DSL for access control lists
|
36
|
+
email: olegdashevskii@gmail.com
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- README.textile
|
43
|
+
files:
|
44
|
+
- CHANGELOG.textile
|
45
|
+
- MIT-LICENSE
|
46
|
+
- README.textile
|
47
|
+
- Rakefile
|
48
|
+
- TODO
|
49
|
+
- VERSION.yml
|
50
|
+
- lib/acl9.rb
|
51
|
+
- lib/acl9/config.rb
|
52
|
+
- lib/acl9/controller_extensions.rb
|
53
|
+
- lib/acl9/controller_extensions/dsl_base.rb
|
54
|
+
- lib/acl9/controller_extensions/generators.rb
|
55
|
+
- lib/acl9/helpers.rb
|
56
|
+
- lib/acl9/model_extensions.rb
|
57
|
+
- lib/acl9/model_extensions/object.rb
|
58
|
+
- lib/acl9/model_extensions/subject.rb
|
59
|
+
- test/access_control_test.rb
|
60
|
+
- test/dsl_base_test.rb
|
61
|
+
- test/helpers_test.rb
|
62
|
+
- test/roles_test.rb
|
63
|
+
- test/support/controllers.rb
|
64
|
+
- test/support/models.rb
|
65
|
+
- test/support/schema.rb
|
66
|
+
- test/test_helper.rb
|
67
|
+
has_rdoc: true
|
68
|
+
homepage: http://github.com/be9/acl9
|
69
|
+
licenses: []
|
70
|
+
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options:
|
73
|
+
- --charset=UTF-8
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: "0"
|
81
|
+
version:
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: "0"
|
87
|
+
version:
|
88
|
+
requirements: []
|
89
|
+
|
90
|
+
rubyforge_project:
|
91
|
+
rubygems_version: 1.3.5
|
92
|
+
signing_key:
|
93
|
+
specification_version: 3
|
94
|
+
summary: Yet another role-based authorization system for Rails
|
95
|
+
test_files:
|
96
|
+
- test/helpers_test.rb
|
97
|
+
- test/support/schema.rb
|
98
|
+
- test/support/models.rb
|
99
|
+
- test/support/controllers.rb
|
100
|
+
- test/dsl_base_test.rb
|
101
|
+
- test/access_control_test.rb
|
102
|
+
- test/test_helper.rb
|
103
|
+
- test/roles_test.rb
|