role_authorization 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -3,17 +3,21 @@ RoleAuthorization::Rules.define :all do
|
|
3
3
|
end
|
4
4
|
|
5
5
|
RoleAuthorization::Rules.define :role do
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
if controller_instance.current_user.blank?
|
7
|
+
false
|
8
|
+
else
|
9
|
+
scope = if options[:scope]
|
10
|
+
if options[:scope].is_a?(Proc)
|
11
|
+
instance_eval(&options[:scope])
|
12
|
+
else
|
13
|
+
options[:scope]
|
14
|
+
end
|
9
15
|
else
|
10
|
-
|
16
|
+
:global
|
11
17
|
end
|
12
|
-
else
|
13
|
-
:global
|
14
|
-
end
|
15
18
|
|
16
|
-
|
19
|
+
controller_instance.current_user.roles(options[:scope] || :global).include?(role)
|
20
|
+
end
|
17
21
|
end
|
18
22
|
|
19
23
|
RoleAuthorization::Rules.define :user do
|