声明性授权和if_attribute不起作用

dig*_*tie 5 conditional authorization ruby-on-rails authlogic declarative-authorization

我和Victor Martin几乎有同样的问题(你可以看到这里提出的问题).

我已经获得声明性授权,可用于几乎所有不涉及使用条件的内容.例如

has_permission_on :users, :to => [:edit, :update, :destroy] do
if_attribute :user => is { current_user }
end
Run Code Online (Sandbox Code Playgroud)

声明授权是否有任何常见的陷阱?我正在使用authlogic,我怀疑应用程序控制器中的'current_user'方法可能是问题的根源.

Del*_*l F 5

请注意,如果您在控制器中使用“filter_access_to”,则需要确保“:attribute_check => true”。没有它,条件“if_attribute”声明什么也不做。

声明性授权文档中有关此的更多详细信息