rails declarative_authorization, find which role has a given privilege

180 views Asked by At

Say I have a number of roles that could perform the same action under different conditions. For instance:

role :beer_pong_player do
  has_permission_on :cups, :to => : drink
    if_attribute :scored_on => true
  end
end

role :casual_party_attendee do
  has_permission_on :cups, :to => :drink
    if_attribute :thirsty => true
  end
end

Is there a way - if current_user is permitted_to drink - know under which role this is true (if the current_user has both roles)?

Thanks much.

(http://www.tzi.org/~sbartsch/declarative_authorization/master/ is the url for declarative_authorization documentation... I've been scouring but can't find what I need)

0

There are 0 answers