我检查了文档,但它仅在包含另外 1 个全局角色时才有效。如何在没有全局角色的情况下进行多角色检查?
user.add_role :admin
user.add_role(:user, group)
user.add_role(:mentor, group)
user.has_all_roles? :admin, {:name => :mentor, :resource => group}
=> true
user.has_all_roles? {:name => :mentor, :resource => group}, {:name => :user, :resource => group}
=> SyntaxError: (irb):27: syntax error, unexpected =>, expecting '}'
user.has_any_role? :admin, {:name => :mentor, :resource => group}, {:name => :user, :resource => group}
=> true
user.has_any_role? {:name => :mentor, :resource => group}, {:name => :user, :resource => group}
=> SyntaxError: (irb):30: syntax error, unexpected =>, expecting '}'