forked from railsadminteam/rails_admin
-
Notifications
You must be signed in to change notification settings - Fork 1
Authorization setup
defkode edited this page Apr 27, 2012
·
3 revisions
Authorization can be added using the authorize_with
method. If you pass a block
it will be triggered through a before filter on every action in Rails Admin.
RailsAdmin.config do |config|
config.authorize_with do
redirect_to main_app.root_path unless warden.user.is_admin?
end
end
To use an authorization adapter, pass the name of the adapter. For example, to use with CanCan, pass it like this.
RailsAdmin.config do |config|
config.authorize_with :cancan
end