Commit 06ba2602 authored by http://jneen.net/'s avatar http://jneen.net/

take the dive - only use abilities from Policies

parent 5b7edc74
...@@ -61,14 +61,7 @@ class Ability ...@@ -61,14 +61,7 @@ class Ability
private private
def uncached_allowed(user, subject) def uncached_allowed(user, subject)
policy_class = BasePolicy.class_for(subject) rescue nil BasePolicy.class_for(subject).abilities(user, subject)
return policy_class.abilities(user, subject) if policy_class
return anonymous_abilities(subject) if user.nil?
return [] unless user.is_a?(User)
return [] if user.blocked?
abilities_by_subject_class(user: user, subject: subject)
end end
def abilities_by_subject_class(user:, subject:) def abilities_by_subject_class(user:, subject:)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment