objectbouncer 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/objectbouncer/base.rb +3 -3
- metadata +1 -1
data/lib/objectbouncer/base.rb
CHANGED
@@ -32,7 +32,7 @@ module ObjectBouncer
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def policies
|
35
|
-
@policies || self.class.
|
35
|
+
@policies || self.class.policies
|
36
36
|
end
|
37
37
|
|
38
38
|
def self.included(klass)
|
@@ -54,10 +54,10 @@ module ObjectBouncer
|
|
54
54
|
return false if current_user.nil? && !enforced?
|
55
55
|
if meth_policies = policies[meth]
|
56
56
|
if !meth_policies[:unless].empty?
|
57
|
-
return false if meth_policies[:unless].detect{|policy| policy.call(current_user,
|
57
|
+
return false if meth_policies[:unless].detect{|policy| policy.call(current_user, self, *args) rescue nil}
|
58
58
|
return true
|
59
59
|
end
|
60
|
-
return true if meth_policies[:if].detect{|policy| policy.call(current_user,
|
60
|
+
return true if meth_policies[:if].detect{|policy| policy.call(current_user, self, *args) rescue nil}
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|