All permissions with declarative_authorization

I have a Rails application using Restful authentication and declarative permission. I have some roles with an administrator.

Is there a way to automatically grant all rights to this role instead of hard-coding each controller in authorization_rules? Sort of:

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

      

Or a uglier introspection approach, maybe?

Thanks in advance

+2


a source to share


1 answer


You can use this if you are using the latest code (the last gem (0.4.1) still doesn't have it):

role :admin do
  has_omnipotence
end

      



In this case, the administrator role will have all permissions for all models.

See commit: 4ecb402f

+4


a source







All Articles