zuul 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/zuul/active_record.rb +29 -7
- data/lib/zuul/version.rb +1 -1
- metadata +47 -47
data/lib/zuul/active_record.rb
CHANGED
@@ -62,10 +62,35 @@ module Zuul
|
|
62
62
|
#
|
63
63
|
# The args parameter is an optional hash of configuration options.
|
64
64
|
def acts_as_authorization_context(args={}, &block)
|
65
|
-
acts_as_authorization_model(args, &block)
|
65
|
+
scope = acts_as_authorization_model(args, &block)
|
66
|
+
prepare_join_classes scope.name
|
66
67
|
include Context
|
67
68
|
end
|
68
69
|
|
70
|
+
# Configure the model to act as a zuul joining model for roles and subjects
|
71
|
+
#
|
72
|
+
# The args parameter is an optional hash of configuration options.
|
73
|
+
def acts_as_authorization_permission_role(args={}, &block)
|
74
|
+
scope = acts_as_authorization_model(args.merge({:permission_role_class => self.name}), &block)
|
75
|
+
include PermissionRole
|
76
|
+
end
|
77
|
+
|
78
|
+
# Configure the model to act as a zuul joining model for roles and subjects
|
79
|
+
#
|
80
|
+
# The args parameter is an optional hash of configuration options.
|
81
|
+
def acts_as_authorization_permission_subject(args={}, &block)
|
82
|
+
scope = acts_as_authorization_model(args.merge({:permission_subject_class => self.name}), &block)
|
83
|
+
include PermissionSubject
|
84
|
+
end
|
85
|
+
|
86
|
+
# Configure the model to act as a zuul joining model for roles and subjects
|
87
|
+
#
|
88
|
+
# The args parameter is an optional hash of configuration options.
|
89
|
+
def acts_as_authorization_role_subject(args={}, &block)
|
90
|
+
scope = acts_as_authorization_model(args.merge({:role_subject_class => self.name}), &block)
|
91
|
+
include RoleSubject
|
92
|
+
end
|
93
|
+
|
69
94
|
# Sets up the join models for a newly defined scope.
|
70
95
|
#
|
71
96
|
# This is similar the the acts_as_authorization_* methods, but it handles all the joining models for a scope.
|
@@ -74,22 +99,19 @@ module Zuul
|
|
74
99
|
|
75
100
|
unless auth_scope(scope).role_subject_class.ancestors.include?(RoleSubject)
|
76
101
|
auth_scope(scope).role_subject_class.instance_eval do
|
77
|
-
|
78
|
-
include RoleSubject
|
102
|
+
acts_as_authorization_role_subject(scope_config.to_h)
|
79
103
|
end
|
80
104
|
end
|
81
105
|
|
82
106
|
if auth_scope(scope).config.with_permissions
|
83
107
|
unless auth_scope(scope).permission_subject_class.ancestors.include?(PermissionSubject)
|
84
108
|
auth_scope(scope).permission_subject_class.instance_eval do
|
85
|
-
|
86
|
-
include PermissionSubject
|
109
|
+
acts_as_authorization_permission_subject(scope_config.to_h)
|
87
110
|
end
|
88
111
|
end
|
89
112
|
unless auth_scope(scope).permission_role_class.ancestors.include?(PermissionRole)
|
90
113
|
auth_scope(scope).permission_role_class.instance_eval do
|
91
|
-
|
92
|
-
include PermissionRole
|
114
|
+
acts_as_authorization_permission_role(scope_config.to_h)
|
93
115
|
end
|
94
116
|
end
|
95
117
|
end
|
data/lib/zuul/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zuul
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-04-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -99,62 +99,62 @@ executables: []
|
|
99
99
|
extensions: []
|
100
100
|
extra_rdoc_files: []
|
101
101
|
files:
|
102
|
+
- lib/zuul.rb
|
102
103
|
- lib/tasks/zuul.rake
|
103
104
|
- lib/zuul_viz.rb
|
105
|
+
- lib/generators/zuul/permission_generator.rb
|
106
|
+
- lib/generators/zuul/role_generator.rb
|
107
|
+
- lib/generators/zuul/permission_subject_generator.rb
|
108
|
+
- lib/generators/zuul/orm_helpers.rb
|
109
|
+
- lib/generators/zuul/role_subject_generator.rb
|
110
|
+
- lib/generators/zuul/templates/permission_subject_existing.rb
|
111
|
+
- lib/generators/zuul/templates/permission_role.rb
|
112
|
+
- lib/generators/zuul/templates/role_subject_existing.rb
|
113
|
+
- lib/generators/zuul/templates/permission_subject.rb
|
114
|
+
- lib/generators/zuul/templates/permission.rb
|
115
|
+
- lib/generators/zuul/templates/permission_role_existing.rb
|
116
|
+
- lib/generators/zuul/templates/permission_existing.rb
|
117
|
+
- lib/generators/zuul/templates/role_existing.rb
|
118
|
+
- lib/generators/zuul/templates/role_subject.rb
|
119
|
+
- lib/generators/zuul/templates/role.rb
|
120
|
+
- lib/generators/zuul/permission_role_generator.rb
|
121
|
+
- lib/generators/zuul/subject_generator.rb
|
122
|
+
- lib/zuul/context.rb
|
123
|
+
- lib/zuul/exceptions/invalid_context.rb
|
124
|
+
- lib/zuul/exceptions/undefined_scope.rb
|
125
|
+
- lib/zuul/exceptions/access_denied.rb
|
126
|
+
- lib/zuul/active_record.rb
|
127
|
+
- lib/zuul/action_controller.rb
|
104
128
|
- lib/zuul/action_controller/evaluators.rb
|
105
129
|
- lib/zuul/action_controller/dsl.rb
|
106
|
-
- lib/zuul/
|
107
|
-
- lib/zuul/
|
108
|
-
- lib/zuul/
|
130
|
+
- lib/zuul/railtie.rb
|
131
|
+
- lib/zuul/configuration.rb
|
132
|
+
- lib/zuul/exceptions.rb
|
109
133
|
- lib/zuul/active_record/context.rb
|
134
|
+
- lib/zuul/active_record/permission_role.rb
|
135
|
+
- lib/zuul/active_record/permission_subject.rb
|
136
|
+
- lib/zuul/active_record/scope.rb
|
110
137
|
- lib/zuul/active_record/permission.rb
|
111
138
|
- lib/zuul/active_record/subject.rb
|
112
139
|
- lib/zuul/active_record/role_subject.rb
|
113
|
-
- lib/zuul/active_record/
|
114
|
-
- lib/zuul/active_record.rb
|
115
|
-
- lib/zuul/railtie.rb
|
116
|
-
- lib/zuul/action_controller.rb
|
117
|
-
- lib/zuul/configuration.rb
|
140
|
+
- lib/zuul/active_record/role.rb
|
118
141
|
- lib/zuul/version.rb
|
119
|
-
- lib/zuul/context.rb
|
120
|
-
- lib/zuul/exceptions.rb
|
121
|
-
- lib/zuul/exceptions/undefined_scope.rb
|
122
|
-
- lib/zuul/exceptions/access_denied.rb
|
123
|
-
- lib/zuul/exceptions/invalid_context.rb
|
124
|
-
- lib/generators/zuul/permission_subject_generator.rb
|
125
|
-
- lib/generators/zuul/role_subject_generator.rb
|
126
|
-
- lib/generators/zuul/subject_generator.rb
|
127
|
-
- lib/generators/zuul/role_generator.rb
|
128
|
-
- lib/generators/zuul/permission_generator.rb
|
129
|
-
- lib/generators/zuul/templates/role_subject_existing.rb
|
130
|
-
- lib/generators/zuul/templates/role.rb
|
131
|
-
- lib/generators/zuul/templates/permission_role.rb
|
132
|
-
- lib/generators/zuul/templates/permission_subject_existing.rb
|
133
|
-
- lib/generators/zuul/templates/permission_existing.rb
|
134
|
-
- lib/generators/zuul/templates/permission.rb
|
135
|
-
- lib/generators/zuul/templates/role_subject.rb
|
136
|
-
- lib/generators/zuul/templates/role_existing.rb
|
137
|
-
- lib/generators/zuul/templates/permission_role_existing.rb
|
138
|
-
- lib/generators/zuul/templates/permission_subject.rb
|
139
|
-
- lib/generators/zuul/orm_helpers.rb
|
140
|
-
- lib/generators/zuul/permission_role_generator.rb
|
141
|
-
- lib/zuul.rb
|
142
142
|
- spec/db/schema.rb
|
143
143
|
- spec/zuul_spec.rb
|
144
|
-
- spec/spec_helper.rb
|
145
144
|
- spec/support/models.rb
|
146
145
|
- spec/support/capture_stdout.rb
|
147
146
|
- spec/zuul/configuration_spec.rb
|
148
|
-
- spec/zuul/
|
149
|
-
- spec/zuul/
|
150
|
-
- spec/zuul/active_record/scope_spec.rb
|
147
|
+
- spec/zuul/active_record_spec.rb
|
148
|
+
- spec/zuul/context_spec.rb
|
151
149
|
- spec/zuul/active_record/permission_spec.rb
|
152
|
-
- spec/zuul/active_record/
|
150
|
+
- spec/zuul/active_record/role_spec.rb
|
153
151
|
- spec/zuul/active_record/role_subject_spec.rb
|
152
|
+
- spec/zuul/active_record/subject_spec.rb
|
154
153
|
- spec/zuul/active_record/permission_role_spec.rb
|
155
154
|
- spec/zuul/active_record/permission_subject_spec.rb
|
156
|
-
- spec/zuul/context_spec.rb
|
157
|
-
- spec/zuul/
|
155
|
+
- spec/zuul/active_record/context_spec.rb
|
156
|
+
- spec/zuul/active_record/scope_spec.rb
|
157
|
+
- spec/spec_helper.rb
|
158
158
|
homepage: http://github.com/markrebec/zuul
|
159
159
|
licenses: []
|
160
160
|
post_install_message:
|
@@ -182,17 +182,17 @@ summary: Authorizaion and ACL for Activerecord and ActionController.
|
|
182
182
|
test_files:
|
183
183
|
- spec/db/schema.rb
|
184
184
|
- spec/zuul_spec.rb
|
185
|
-
- spec/spec_helper.rb
|
186
185
|
- spec/support/models.rb
|
187
186
|
- spec/support/capture_stdout.rb
|
188
187
|
- spec/zuul/configuration_spec.rb
|
189
|
-
- spec/zuul/
|
190
|
-
- spec/zuul/
|
191
|
-
- spec/zuul/active_record/scope_spec.rb
|
188
|
+
- spec/zuul/active_record_spec.rb
|
189
|
+
- spec/zuul/context_spec.rb
|
192
190
|
- spec/zuul/active_record/permission_spec.rb
|
193
|
-
- spec/zuul/active_record/
|
191
|
+
- spec/zuul/active_record/role_spec.rb
|
194
192
|
- spec/zuul/active_record/role_subject_spec.rb
|
193
|
+
- spec/zuul/active_record/subject_spec.rb
|
195
194
|
- spec/zuul/active_record/permission_role_spec.rb
|
196
195
|
- spec/zuul/active_record/permission_subject_spec.rb
|
197
|
-
- spec/zuul/context_spec.rb
|
198
|
-
- spec/zuul/
|
196
|
+
- spec/zuul/active_record/context_spec.rb
|
197
|
+
- spec/zuul/active_record/scope_spec.rb
|
198
|
+
- spec/spec_helper.rb
|