authorization-san 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/authorization/block_access.rb +5 -4
- metadata +3 -3
@@ -24,9 +24,10 @@ module Authorization
|
|
24
24
|
die_if_undefined
|
25
25
|
unless @authenticated.nil?
|
26
26
|
if @authenticated.respond_to?(:role)
|
27
|
+
checked = @authenticated.role.to_s
|
27
28
|
return true if _access_allowed?(params, @authenticated.role, @authenticated)
|
28
29
|
end
|
29
|
-
access_allowed_for.keys.each do |role|
|
30
|
+
(access_allowed_for.keys-[checked]).each do |role|
|
30
31
|
if @authenticated.respond_to?("#{role}?") and @authenticated.send("#{role}?")
|
31
32
|
return true if _access_allowed?(params, role, @authenticated)
|
32
33
|
end
|
@@ -84,14 +85,14 @@ module Authorization
|
|
84
85
|
if rules = access_allowed_for[role]
|
85
86
|
rules.each do |rule|
|
86
87
|
if _access_allowed_with_rule?(rule, params, role, authenticated)
|
87
|
-
logger.debug(" \e[32mAccess
|
88
|
+
logger.debug(" \e[32mAccess granted by rule #{rule.inspect} for #{role}\e[0m")
|
88
89
|
return true
|
89
90
|
else
|
90
|
-
logger.debug(" \e[31mAccess
|
91
|
+
logger.debug(" \e[31mAccess denied by rule #{rule.inspect} for #{role}\e[0m")
|
91
92
|
end
|
92
93
|
end
|
93
94
|
else
|
94
|
-
logger.debug(" \e[31mCan't find rules for
|
95
|
+
logger.debug(" \e[31mCan't find rules for #{role}\e[0m")
|
95
96
|
end
|
96
97
|
false
|
97
98
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authorization-san
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 2.0.
|
9
|
+
- 1
|
10
|
+
version: 2.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Manfred Stienstra
|