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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7366ce69bda79a5c0b5072f2f7413684239650d8
4
- data.tar.gz: 87805e112d8097aae45ddb19c11537f1aab07d24
3
+ metadata.gz: c51edf01b106b36c542d3f3a84be0c446182e438
4
+ data.tar.gz: 4a2cee1e5feb96c6e13f999fb342640cd602c96c
5
5
  SHA512:
6
- metadata.gz: 5879d63794e172de154b8562e6bea4f4303a0b02c8a3f4b5adf682d8412aedf0d32fd46abcabc3f600ad0bc050b827031661f9cd659e1a0650da057e18fd3b61
7
- data.tar.gz: bd050cc3a0b0fc0b5fdd21e6430f9c4d9f54414299e58bb75d649c0a4be973b6afaa968ca24937df99d1027dfcf894e059e0496bc08addd967de5bc54789e366
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 user_signed_in?
63
+ if current_user || @user
64
64
  forbidden! message
65
65
  else
66
- authenticate_user!
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 }
@@ -1,3 +1,3 @@
1
1
  module Petergate
2
- VERSION = "1.5.3"
2
+ VERSION = "1.5.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: petergate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.3
4
+ version: 1.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Isaac Sloan