Using Pundit for all-access “super_admin” role

I’m wondering the best/simplest way to give a user “super_admin” access using the Pundit gem — or, what’s the simplest way to give a user access to all controller actions across the site?

I realize I can edit the policy file for each controller, then add something like

def delete?
  user.is_super_admin?
end

…to each and every action, in each and every controller. But is there a single place where I could define this?

I’ve taken a look at the application policy, which all of my other controller policies inherit from, but I believe these actions are all overridden in my controllers anyway so I don’t think I could define it there.

I’m sure others have needed to implement this feature? What’s the simplest way? Thanks!

Leave a Comment