Question

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

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top