Open jendiamond opened 8 years ago
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
gem "cancancan"
to Gemfile$ bundle
$ rails g cancan:ability
create app/models/ability.rb
config/initializers/rails_admin.rb
RailsAdmin.config do |config|
config.authorize_with :cancan #TODO add cancancan to rails_admin config
end
RailsAdmin.config do |config|
# == Devise ==
config.authenticate_with do
warden.authenticate! scope: :member
end
config.current_user_method(&:current_member)
# == Cancan && Rails Admin https://github.com/sferik/rails_admin/wiki/Base-configuration
config.authorize_with :cancan
## == Gravatar integration ==
## To disable Gravatar integration in Navigation Bar set to false
# config.show_gravatar true
config.actions do
dashboard # mandatory
index # mandatory
new
export
bulk_delete
show
edit
delete
show_in_app
## With an audit adapter, you can add:
# history_index
# history_show
end
end
[Pull Request #]()
http://blog.kangkyu.com/authorization-with-pundit
CanCanCan
SuperAdmin
Admin
Applicant (Member)
Guest