petergate 1.6.7 → 1.6.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/petergate/action_controller/base.rb +14 -20
- data/lib/petergate/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: 266c473c940d039ad1098a27bd8a4ae3920b130d
|
4
|
+
data.tar.gz: 08c543814c39ca17f9436bfeb2ef369b6b2f5284
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8b185bf7b5d2315bab81d230ed46b33bb440171d2080974b755a69f223bab325bc07b777f586184fc25318144384fd0a2d070b43ec2430048801cf2d9208d16
|
7
|
+
data.tar.gz: d16bc5c3607cc1d4480b4fbc254eaede8fcaf13f29718fb68464b0036665fa7d89a7c277ad15d59bdede8c4fdfeebd8d9fc1295f3988a7be43507931842aba42
|
@@ -43,20 +43,14 @@ module Petergate
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
permissions(self.class.controller_rules)
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
if message == false || message.is_a?(String)
|
55
|
-
if current_user || @user
|
56
|
-
forbidden! message
|
57
|
-
else
|
58
|
-
unauthorized!
|
59
|
-
end
|
46
|
+
before_action do
|
47
|
+
unless logged_in?(:root_admin)
|
48
|
+
message = permissions(self.class.controller_rules)
|
49
|
+
if message == false || message.is_a?(String)
|
50
|
+
if current_user || @user
|
51
|
+
forbidden! message
|
52
|
+
else
|
53
|
+
unauthorized!
|
60
54
|
end
|
61
55
|
end
|
62
56
|
end
|
@@ -68,7 +62,7 @@ module Petergate
|
|
68
62
|
|
69
63
|
def self.included(base)
|
70
64
|
base.extend(ClassMethods)
|
71
|
-
base.helper_method :logged_in?, :forbidden!
|
65
|
+
base.helper_method :logged_in?, :forbidden!, :unauthorized!
|
72
66
|
end
|
73
67
|
|
74
68
|
def parse_permission_rules(rules)
|
@@ -78,11 +72,11 @@ module Petergate
|
|
78
72
|
v == :all ? self.class.all_actions : raise("No action for: #{v}")
|
79
73
|
when "Hash"
|
80
74
|
v[:except].present? ? self.class.except_actions(v[:except]) : raise("Invalid values for except: #{v.values}")
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
75
|
+
when "Array"
|
76
|
+
v
|
77
|
+
else
|
78
|
+
raise("No action for: #{v}")
|
79
|
+
end
|
86
80
|
|
87
81
|
h.merge({k => special_values})
|
88
82
|
end
|
data/lib/petergate/version.rb
CHANGED