-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Authorization
Sergio Rodríguez edited this page Apr 4, 2017
·
8 revisions
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 :cancan
end