aclize 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aclize.rb +6 -5
- data/lib/aclize/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2dc5b30f8e94b4cb8ec3a2aba6f6c3a4a46d3093
|
4
|
+
data.tar.gz: 626f6ccc4831edb8101c0d521b49c7b8d35093fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0762279bf13cc60194f96cb89b71762f1f6133e8e3f925cdfa5a589513cf622639c73c2d5cf4f1aeab4d40469b1c9e4da22f152aecc24bca386ee7192b70bdc
|
7
|
+
data.tar.gz: 30bcfd4450eb78434d230bb05e6811d9300075b833c23291c0f5a05d47228ee64ac5684d9be3cd102aee10d16933e703376fc7709fad45554bd94318e66e05e9
|
data/lib/aclize.rb
CHANGED
@@ -64,13 +64,14 @@ module Aclize
|
|
64
64
|
# apply the ACL for a specific role and unauthorize if the user is not permitted
|
65
65
|
# to access controller action or the path
|
66
66
|
def treat_as(role)
|
67
|
-
acl
|
67
|
+
acl = @_aclize_acl.get_acl_for(role)
|
68
|
+
path = request.path.gsub(/^#{relative_url_root}/, '')
|
68
69
|
unauthorize! unless acl
|
69
70
|
|
70
|
-
if acl.controllers.permitted?(
|
71
|
-
unauthorize! if acl.paths.denied?(
|
71
|
+
if acl.controllers.permitted?(controller_path, action_name)
|
72
|
+
unauthorize! if acl.paths.denied?(path)
|
72
73
|
else
|
73
|
-
unauthorize! unless acl.paths.permitted?(
|
74
|
+
unauthorize! unless acl.paths.permitted?(path)
|
74
75
|
end
|
75
76
|
end
|
76
77
|
|
@@ -84,7 +85,7 @@ module Aclize
|
|
84
85
|
# In no callbacks were defined for unauthorized access, Aclize will render a
|
85
86
|
# default 403 Forbidden page. Otherwise, the control will be passed to the callback.
|
86
87
|
def unauthorize!
|
87
|
-
path = request.
|
88
|
+
path = request.path
|
88
89
|
flash.now[:alert] = I18n.t("aclize.unauthorized", path: path)
|
89
90
|
|
90
91
|
if @_aclize_callback.nil?
|
data/lib/aclize/version.rb
CHANGED