acl9 0.12.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +21 -7
- data/.travis.yml +19 -0
- data/Appraisals +8 -0
- data/CONTRIBUTING.md +58 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +88 -32
- data/LICENSE +9 -0
- data/README.md +156 -0
- data/Rakefile +6 -3
- data/acl9.gemspec +10 -13
- data/gemfiles/rails_4.0.gemfile +8 -0
- data/gemfiles/rails_4.1.gemfile +8 -0
- data/lib/acl9/model_extensions/for_subject.rb +5 -1
- data/lib/acl9/model_extensions.rb +3 -24
- data/lib/acl9/version.rb +1 -1
- data/lib/acl9.rb +1 -1
- data/test/controller_extensions/actions_test.rb +167 -0
- data/test/controller_extensions/anon_test.rb +39 -0
- data/test/controller_extensions/base.rb +96 -0
- data/test/controller_extensions/basics_test.rb +44 -0
- data/test/controller_extensions/conditions_test.rb +48 -0
- data/test/controller_extensions/method_test.rb +50 -0
- data/test/controller_extensions/multi_match_test.rb +142 -0
- data/test/controller_extensions/multiple_role_arguments_test.rb +135 -0
- data/test/controller_extensions/prepositions_test.rb +99 -0
- data/test/controller_extensions/pseudo_role_test.rb +26 -0
- data/test/controller_extensions/role_test.rb +75 -0
- data/test/controllers/acl_action_override_test.rb +24 -0
- data/test/controllers/acl_arguments_test.rb +5 -0
- data/test/controllers/acl_block_test.rb +5 -0
- data/test/controllers/acl_boolean_method_test.rb +5 -0
- data/test/controllers/acl_helper_method_test.rb +26 -0
- data/test/controllers/acl_ivars_test.rb +15 -0
- data/test/controllers/acl_method2_test.rb +6 -0
- data/test/controllers/acl_method_test.rb +6 -0
- data/test/controllers/acl_object_hash_test.rb +18 -0
- data/test/controllers/acl_query_method_named_test.rb +9 -0
- data/test/controllers/acl_query_method_test.rb +9 -0
- data/test/controllers/acl_query_method_with_lambda_test.rb +9 -0
- data/test/controllers/acl_query_mixin.rb +51 -0
- data/test/controllers/acl_subject_method_test.rb +15 -0
- data/test/controllers/arguments_checking_test.rb +43 -0
- data/test/dummy/app/controllers/acl_action_override.rb +15 -0
- data/test/dummy/app/controllers/acl_arguments.rb +10 -0
- data/test/dummy/app/controllers/acl_block.rb +6 -0
- data/test/dummy/app/controllers/acl_boolean_method.rb +23 -0
- data/test/dummy/app/controllers/acl_helper_method.rb +11 -0
- data/test/dummy/app/controllers/acl_ivars.rb +17 -0
- data/test/dummy/app/controllers/acl_method.rb +6 -0
- data/test/dummy/app/controllers/acl_method2.rb +6 -0
- data/test/dummy/app/controllers/acl_objects_hash.rb +10 -0
- data/test/dummy/app/controllers/acl_query_method.rb +9 -0
- data/test/dummy/app/controllers/acl_query_method_named.rb +13 -0
- data/test/dummy/app/controllers/acl_query_method_with_lambda.rb +9 -0
- data/test/dummy/app/controllers/acl_subject_method.rb +16 -0
- data/test/dummy/app/controllers/application_controller.rb +7 -0
- data/test/dummy/app/controllers/empty_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/some_helper.rb +8 -0
- data/test/dummy/app/models/.keep +0 -0
- data/test/dummy/app/models/access.rb +3 -0
- data/test/dummy/app/models/account.rb +3 -0
- data/test/dummy/app/models/bar.rb +3 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/models/foo.rb +3 -0
- data/test/dummy/app/models/foo_bar.rb +3 -0
- data/test/dummy/app/models/other/foo.rb +5 -0
- data/test/dummy/app/models/other/role.rb +5 -0
- data/test/dummy/app/models/other/user.rb +5 -0
- data/test/dummy/app/models/role.rb +3 -0
- data/test/dummy/app/models/user.rb +3 -0
- data/test/dummy/app/models/uuid.rb +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +4 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +78 -0
- data/test/dummy/config/environments/test.rb +39 -0
- data/test/dummy/config/initializers/assets.rb +8 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/secrets.rb +1 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +3 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/migrate/20141117132218_create_tables.rb +102 -0
- data/test/helpers/helper_test.rb +89 -0
- data/test/models/roles_test.rb +251 -0
- data/test/models/roles_with_custom_association_names_test.rb +28 -0
- data/test/models/roles_with_custom_class_names_test.rb +28 -0
- data/test/models/system_roles_test.rb +16 -0
- data/test/models/users_roles_and_subjects_with_namespaced_class_names_test.rb +30 -0
- data/test/test_helper.rb +76 -23
- data/test/version_test.rb +2 -2
- metadata +190 -74
- data/README.textile +0 -921
- data/VERSION.yml +0 -5
- data/init.rb +0 -1
- data/test/access_control_test.rb +0 -338
- data/test/dsl_base_test.rb +0 -795
- data/test/helpers_test.rb +0 -133
- data/test/roles_test.rb +0 -370
- data/test/support/controllers.rb +0 -207
- data/test/support/models.rb +0 -59
- data/test/support/schema.rb +0 -93
data/test/support/models.rb
DELETED
@@ -1,59 +0,0 @@
|
|
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 Uuid < ActiveRecord::Base
|
14
|
-
set_primary_key "uuid"
|
15
|
-
acts_as_authorization_object
|
16
|
-
end
|
17
|
-
|
18
|
-
class Bar < ActiveRecord::Base
|
19
|
-
acts_as_authorization_object
|
20
|
-
end
|
21
|
-
|
22
|
-
class AnotherSubject < ActiveRecord::Base
|
23
|
-
acts_as_authorization_subject :role_class_name => 'AnotherRole'
|
24
|
-
end
|
25
|
-
|
26
|
-
class AnotherRole < ActiveRecord::Base
|
27
|
-
acts_as_authorization_role :subject_class_name => "AnotherSubject"
|
28
|
-
end
|
29
|
-
|
30
|
-
class FooBar < ActiveRecord::Base
|
31
|
-
acts_as_authorization_object :role_class_name => 'AnotherRole', :subject_class_name => "AnotherSubject"
|
32
|
-
end
|
33
|
-
|
34
|
-
class DifferentAssociationNameSubject < ActiveRecord::Base
|
35
|
-
acts_as_authorization_subject :association_name => 'roles', :role_class_name => "DifferentAssociationNameRole"
|
36
|
-
end
|
37
|
-
|
38
|
-
class DifferentAssociationNameRole < ActiveRecord::Base
|
39
|
-
acts_as_authorization_role :subject_class_name => "DifferentAssociationNameSubject"
|
40
|
-
end
|
41
|
-
|
42
|
-
module Other
|
43
|
-
|
44
|
-
class Other::User < ActiveRecord::Base
|
45
|
-
set_table_name "other_users"
|
46
|
-
acts_as_authorization_subject :join_table_name => "other_roles_other_users", :role_class_name => "Other::Role"
|
47
|
-
end
|
48
|
-
|
49
|
-
class Other::Role < ActiveRecord::Base
|
50
|
-
set_table_name "other_roles"
|
51
|
-
acts_as_authorization_role :join_table_name => "other_roles_other_users", :subject_class_name => "Other::User"
|
52
|
-
end
|
53
|
-
|
54
|
-
class Other::FooBar < ActiveRecord::Base
|
55
|
-
set_table_name "other_foo_bars"
|
56
|
-
acts_as_authorization_object :role_class_name => 'Other::Role', :subject_class_name => "Other::User"
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
data/test/support/schema.rb
DELETED
@@ -1,93 +0,0 @@
|
|
1
|
-
ActiveRecord::Schema.define(:version => 0) do
|
2
|
-
create_table "roles", :force => true do |t|
|
3
|
-
t.string "name", :limit => 40
|
4
|
-
t.boolean "system", :default=>false
|
5
|
-
t.string "authorizable_type", :limit => 40
|
6
|
-
t.string "authorizable_id"
|
7
|
-
t.datetime "created_at"
|
8
|
-
t.datetime "updated_at"
|
9
|
-
end
|
10
|
-
|
11
|
-
create_table "another_roles", :force => true do |t|
|
12
|
-
t.string "name", :limit => 40
|
13
|
-
t.string "authorizable_type", :limit => 40
|
14
|
-
t.integer "authorizable_id"
|
15
|
-
t.datetime "created_at"
|
16
|
-
t.datetime "updated_at"
|
17
|
-
end
|
18
|
-
|
19
|
-
create_table "different_association_name_roles", :force => true do |t|
|
20
|
-
t.string "name", :limit => 40
|
21
|
-
t.string "authorizable_type", :limit => 40
|
22
|
-
t.integer "authorizable_id"
|
23
|
-
t.datetime "created_at"
|
24
|
-
t.datetime "updated_at"
|
25
|
-
end
|
26
|
-
|
27
|
-
create_table "users", :force => true do |t| end
|
28
|
-
create_table "another_subjects", :force => true do |t| end
|
29
|
-
create_table "different_association_name_subjects", :force => true do |t| end
|
30
|
-
|
31
|
-
create_table "roles_users", :id => false, :force => true do |t|
|
32
|
-
t.integer "user_id"
|
33
|
-
t.integer "role_id"
|
34
|
-
t.datetime "created_at"
|
35
|
-
t.datetime "updated_at"
|
36
|
-
end
|
37
|
-
|
38
|
-
create_table "another_roles_another_subjects", :id => false, :force => true do |t|
|
39
|
-
t.integer "another_subject_id"
|
40
|
-
t.integer "another_role_id"
|
41
|
-
t.datetime "created_at"
|
42
|
-
t.datetime "updated_at"
|
43
|
-
end
|
44
|
-
|
45
|
-
create_table "different_association_name_roles_different_association_name_subjects", :id => false, :force => true do |t|
|
46
|
-
t.integer "different_association_name_subject_id"
|
47
|
-
t.integer "different_association_name_role_id"
|
48
|
-
t.datetime "created_at"
|
49
|
-
t.datetime "updated_at"
|
50
|
-
end
|
51
|
-
|
52
|
-
create_table "foos", :force => true do |t|
|
53
|
-
t.datetime "created_at"
|
54
|
-
t.datetime "updated_at"
|
55
|
-
end
|
56
|
-
|
57
|
-
create_table "uuids", :id => false, :force => true do |t|
|
58
|
-
t.string "uuid"
|
59
|
-
t.datetime "created_at"
|
60
|
-
t.datetime "updated_at"
|
61
|
-
end
|
62
|
-
|
63
|
-
create_table "bars", :force => true do |t|
|
64
|
-
t.datetime "created_at"
|
65
|
-
t.datetime "updated_at"
|
66
|
-
end
|
67
|
-
create_table "foo_bars", :force => true do |t|
|
68
|
-
t.datetime "created_at"
|
69
|
-
t.datetime "updated_at"
|
70
|
-
end
|
71
|
-
|
72
|
-
# namespaced
|
73
|
-
|
74
|
-
create_table "other_roles", :force => true do |t|
|
75
|
-
t.string "name", :limit => 40
|
76
|
-
t.string "authorizable_type", :limit => 40
|
77
|
-
t.integer "authorizable_id"
|
78
|
-
t.datetime "created_at"
|
79
|
-
t.datetime "updated_at"
|
80
|
-
end
|
81
|
-
create_table "other_users", :force => true do |t| end
|
82
|
-
create_table "other_roles_other_users", :id => false, :force => true do |t|
|
83
|
-
t.integer "user_id"
|
84
|
-
t.integer "role_id"
|
85
|
-
t.datetime "created_at"
|
86
|
-
t.datetime "updated_at"
|
87
|
-
end
|
88
|
-
create_table "other_foo_bars", :force => true do |t|
|
89
|
-
t.datetime "created_at"
|
90
|
-
t.datetime "updated_at"
|
91
|
-
end
|
92
|
-
|
93
|
-
end
|