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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad2ca3aedcf715c1b73a506449725242a0be4d3e
4
- data.tar.gz: b0cabc242f2cd1e80bda78162633356aa0a7216b
3
+ metadata.gz: 266c473c940d039ad1098a27bd8a4ae3920b130d
4
+ data.tar.gz: 08c543814c39ca17f9436bfeb2ef369b6b2f5284
5
5
  SHA512:
6
- metadata.gz: b672cd4a53dae9a55e3cb4cde2f9f3ce0e06084553af450c67bbb963c6855baad5bba8639a3c16115ef2f8afa5ce5f54648b959920af519ef0c3c33b202efa01
7
- data.tar.gz: 93876867cbf3d0e0fa16b0a6d1451ebd1acd10d518190734f35d15b6be8dec68df3ad9502621cdfb1c5b98d35ac168f1af92488361d7f49b4b1a8e2602f3f3f9
6
+ metadata.gz: f8b185bf7b5d2315bab81d230ed46b33bb440171d2080974b755a69f223bab325bc07b777f586184fc25318144384fd0a2d070b43ec2430048801cf2d9208d16
7
+ data.tar.gz: d16bc5c3607cc1d4480b4fbc254eaede8fcaf13f29718fb68464b0036665fa7d89a7c277ad15d59bdede8c4fdfeebd8d9fc1295f3988a7be43507931842aba42
@@ -43,20 +43,14 @@ module Petergate
43
43
  end
44
44
  end
45
45
 
46
- class_eval do
47
- def check_access
48
- permissions(self.class.controller_rules)
49
- end
50
-
51
- before_action do
52
- unless logged_in?(:root_admin)
53
- message= defined?(check_access) ? check_access : true
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
- when "Array"
82
- v
83
- else
84
- raise("No action for: #{v}")
85
- end
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
@@ -1,3 +1,3 @@
1
1
  module Petergate
2
- VERSION = "1.6.7"
2
+ VERSION = "1.6.8"
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.6.7
4
+ version: 1.6.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Isaac Sloan