简体   繁体   中英

All permissions with declarative_authorization

I have a Rails application using Restful authentication and declarative authorization. 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? 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):

role :admin do
  has_omnipotence
end

With that the admin role would have all permissions on all models.

See the commit: 4ecb402f

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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