Authorization - railsadminteam/rails_admin GitHub Wiki
Authorization can be added using the authorize_with
method. If you pass a block
it will be triggered through a before_action
on every action in Rails Admin.
For example:
RailsAdmin.config do |config|
config.authorize_with do
redirect_to main_app.root_path unless current_user.is_admin?
end
end
To use an authorization adapter, pass the name of the adapter. For example, to use with CanCanCan, pass it like this.
RailsAdmin.config do |config|
config.authorize_with :cancancan
end
Also, there's built-in support for Pundit:
RailsAdmin.config do |config|
config.authorize_with :pundit
end