rails declarative_authorization,查找哪个角色具有给定权限

时间:2012-01-14 01:56:44

标签: ruby-on-rails declarative-authorization

假设我有许多角色可以在不同条件下执行相同的操作。例如:

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

有没有办法 - 如果current_user被允许喝酒 - 知道哪个角色这是真的(如果current_user有两个角色)?

非常感谢。

(http://www.tzi.org/~sbartsch/declarative_authorization/master/是declarative_authorization文档的网址......我一直在搜索,但找不到我需要的内容)

0 个答案:

没有答案