acl9 0.12.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +21 -7
  3. data/.travis.yml +19 -0
  4. data/Appraisals +8 -0
  5. data/CONTRIBUTING.md +58 -0
  6. data/Gemfile +2 -0
  7. data/Gemfile.lock +88 -32
  8. data/LICENSE +9 -0
  9. data/README.md +156 -0
  10. data/Rakefile +6 -3
  11. data/acl9.gemspec +10 -13
  12. data/gemfiles/rails_4.0.gemfile +8 -0
  13. data/gemfiles/rails_4.1.gemfile +8 -0
  14. data/lib/acl9/model_extensions/for_subject.rb +5 -1
  15. data/lib/acl9/model_extensions.rb +3 -24
  16. data/lib/acl9/version.rb +1 -1
  17. data/lib/acl9.rb +1 -1
  18. data/test/controller_extensions/actions_test.rb +167 -0
  19. data/test/controller_extensions/anon_test.rb +39 -0
  20. data/test/controller_extensions/base.rb +96 -0
  21. data/test/controller_extensions/basics_test.rb +44 -0
  22. data/test/controller_extensions/conditions_test.rb +48 -0
  23. data/test/controller_extensions/method_test.rb +50 -0
  24. data/test/controller_extensions/multi_match_test.rb +142 -0
  25. data/test/controller_extensions/multiple_role_arguments_test.rb +135 -0
  26. data/test/controller_extensions/prepositions_test.rb +99 -0
  27. data/test/controller_extensions/pseudo_role_test.rb +26 -0
  28. data/test/controller_extensions/role_test.rb +75 -0
  29. data/test/controllers/acl_action_override_test.rb +24 -0
  30. data/test/controllers/acl_arguments_test.rb +5 -0
  31. data/test/controllers/acl_block_test.rb +5 -0
  32. data/test/controllers/acl_boolean_method_test.rb +5 -0
  33. data/test/controllers/acl_helper_method_test.rb +26 -0
  34. data/test/controllers/acl_ivars_test.rb +15 -0
  35. data/test/controllers/acl_method2_test.rb +6 -0
  36. data/test/controllers/acl_method_test.rb +6 -0
  37. data/test/controllers/acl_object_hash_test.rb +18 -0
  38. data/test/controllers/acl_query_method_named_test.rb +9 -0
  39. data/test/controllers/acl_query_method_test.rb +9 -0
  40. data/test/controllers/acl_query_method_with_lambda_test.rb +9 -0
  41. data/test/controllers/acl_query_mixin.rb +51 -0
  42. data/test/controllers/acl_subject_method_test.rb +15 -0
  43. data/test/controllers/arguments_checking_test.rb +43 -0
  44. data/test/dummy/app/controllers/acl_action_override.rb +15 -0
  45. data/test/dummy/app/controllers/acl_arguments.rb +10 -0
  46. data/test/dummy/app/controllers/acl_block.rb +6 -0
  47. data/test/dummy/app/controllers/acl_boolean_method.rb +23 -0
  48. data/test/dummy/app/controllers/acl_helper_method.rb +11 -0
  49. data/test/dummy/app/controllers/acl_ivars.rb +17 -0
  50. data/test/dummy/app/controllers/acl_method.rb +6 -0
  51. data/test/dummy/app/controllers/acl_method2.rb +6 -0
  52. data/test/dummy/app/controllers/acl_objects_hash.rb +10 -0
  53. data/test/dummy/app/controllers/acl_query_method.rb +9 -0
  54. data/test/dummy/app/controllers/acl_query_method_named.rb +13 -0
  55. data/test/dummy/app/controllers/acl_query_method_with_lambda.rb +9 -0
  56. data/test/dummy/app/controllers/acl_subject_method.rb +16 -0
  57. data/test/dummy/app/controllers/application_controller.rb +7 -0
  58. data/test/dummy/app/controllers/empty_controller.rb +5 -0
  59. data/test/dummy/app/helpers/application_helper.rb +2 -0
  60. data/test/dummy/app/helpers/some_helper.rb +8 -0
  61. data/test/dummy/app/models/.keep +0 -0
  62. data/test/dummy/app/models/access.rb +3 -0
  63. data/test/dummy/app/models/account.rb +3 -0
  64. data/test/dummy/app/models/bar.rb +3 -0
  65. data/test/dummy/app/models/concerns/.keep +0 -0
  66. data/test/dummy/app/models/foo.rb +3 -0
  67. data/test/dummy/app/models/foo_bar.rb +3 -0
  68. data/test/dummy/app/models/other/foo.rb +5 -0
  69. data/test/dummy/app/models/other/role.rb +5 -0
  70. data/test/dummy/app/models/other/user.rb +5 -0
  71. data/test/dummy/app/models/role.rb +3 -0
  72. data/test/dummy/app/models/user.rb +3 -0
  73. data/test/dummy/app/models/uuid.rb +4 -0
  74. data/test/dummy/config/application.rb +23 -0
  75. data/test/dummy/config/boot.rb +4 -0
  76. data/test/dummy/config/database.yml +25 -0
  77. data/test/dummy/config/environment.rb +5 -0
  78. data/test/dummy/config/environments/development.rb +37 -0
  79. data/test/dummy/config/environments/production.rb +78 -0
  80. data/test/dummy/config/environments/test.rb +39 -0
  81. data/test/dummy/config/initializers/assets.rb +8 -0
  82. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  83. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  84. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  85. data/test/dummy/config/initializers/inflections.rb +16 -0
  86. data/test/dummy/config/initializers/mime_types.rb +4 -0
  87. data/test/dummy/config/initializers/secrets.rb +1 -0
  88. data/test/dummy/config/initializers/session_store.rb +3 -0
  89. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  90. data/test/dummy/config/locales/en.yml +23 -0
  91. data/test/dummy/config/routes.rb +3 -0
  92. data/test/dummy/config.ru +4 -0
  93. data/test/dummy/db/migrate/20141117132218_create_tables.rb +102 -0
  94. data/test/helpers/helper_test.rb +89 -0
  95. data/test/models/roles_test.rb +251 -0
  96. data/test/models/roles_with_custom_association_names_test.rb +28 -0
  97. data/test/models/roles_with_custom_class_names_test.rb +28 -0
  98. data/test/models/system_roles_test.rb +16 -0
  99. data/test/models/users_roles_and_subjects_with_namespaced_class_names_test.rb +30 -0
  100. data/test/test_helper.rb +76 -23
  101. data/test/version_test.rb +2 -2
  102. metadata +190 -74
  103. data/README.textile +0 -921
  104. data/VERSION.yml +0 -5
  105. data/init.rb +0 -1
  106. data/test/access_control_test.rb +0 -338
  107. data/test/dsl_base_test.rb +0 -795
  108. data/test/helpers_test.rb +0 -133
  109. data/test/roles_test.rb +0 -370
  110. data/test/support/controllers.rb +0 -207
  111. data/test/support/models.rb +0 -59
  112. data/test/support/schema.rb +0 -93
@@ -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
@@ -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