petergate 1.5.3 → 1.5.5
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 +11 -2
- 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: c51edf01b106b36c542d3f3a84be0c446182e438
|
4
|
+
data.tar.gz: 4a2cee1e5feb96c6e13f999fb342640cd602c96c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ebb8fa08e5196fad85f10bfefe66b73c5ebc108ff4fdd90feef10efcc93b52094ad9a0a7243428354c75afddb05184829753366eee7f302505bf05800739bb8
|
7
|
+
data.tar.gz: d3bde72299efaace7a48e33d128478c98ad601950a1688a9dee760c568c928d5dd415a11d707b154ced26cddf00fa240d693cda462c1d4f27d852bd14a4a94d0
|
@@ -60,10 +60,10 @@ module Petergate
|
|
60
60
|
unless logged_in?(:root_admin)
|
61
61
|
message= defined?(check_access) ? check_access : true
|
62
62
|
if message == false || message.is_a?(String)
|
63
|
-
if
|
63
|
+
if current_user || @user
|
64
64
|
forbidden! message
|
65
65
|
else
|
66
|
-
|
66
|
+
unauthorized!
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
@@ -106,6 +106,15 @@ module Petergate
|
|
106
106
|
defined?(self.class.controller_message) ? self.class.controller_message : 'Permission Denied'
|
107
107
|
end
|
108
108
|
|
109
|
+
def unauthorized!
|
110
|
+
respond_to do |format|
|
111
|
+
format.any(:js, :json, :xml) { render nothing: true, status: :unauthorized }
|
112
|
+
format.html do
|
113
|
+
authenticate_user!
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
109
118
|
def forbidden!(msg = nil)
|
110
119
|
respond_to do |format|
|
111
120
|
format.any(:js, :json, :xml) { render nothing: true, status: :forbidden }
|
data/lib/petergate/version.rb
CHANGED