简体   繁体   English

具有clarativeative_authorization的所有权限

[英]All permissions with declarative_authorization

I have a Rails application using Restful authentication and declarative authorization. 我有一个使用Restful身份验证和声明性授权的Rails应用程序。 I have some roles with an admin. 我和管理员有一些角色。

Is there any method to have automatically granted all permissions to this role, instead of hardcode every controller in the authorization_rules? 是否有任何方法可以自动授予该角色所有权限,而不是对Authorization_rules中的每个控制器进行硬编码? Something like: 就像是:

role :admin do 
  has_permission_on :everything, :to => :manage
end

Or a uglier approach with introspection, maybe? 还是内省的更丑陋的方法?

Thanks in advance 提前致谢

You can use this if you use the latest code (the latest gem (0.4.1) still doesn't have it): 如果您使用最新的代码(最新的gem(0.4.1)仍然没有),则可以使用此代码:

role :admin do
  has_omnipotence
end

With that the admin role would have all permissions on all models. 这样,管理员角色将对所有模型具有所有权限。

See the commit: 4ecb402f 查看提交: 4ecb402f

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM