You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class Ability
include CanCan::Ability
include ActiveAdminRole::CanCan::Ability
def initialize(user)
user ||= AdminUser.new
if user.super_user?
can :manage, :all
else
register_role_based_abilities(user)
end
# NOTE: Everyone can read the page of Permission Deny
can :read, ActiveAdmin::Page, name: 'Dashboard'
end
end
The text was updated successfully, but these errors were encountered:
harisbilal1
changed the title
Batch action of admin user view not displaying assign as staff and other default roles.
Batch action of admin user view not displaying assign as staff and other default roles in Rails 7.
Jan 5, 2023
Steps to reproduce
ActiveAdmin version: activeadmin (>= 1.2.0)
ActiveAdminRole version: active_admin_role (0.2.2)
Rails version: 7.0.4
Ruby version: 3.1.0
config/initializers/active_admin_role.rb :-
ActiveAdminRole.configure do |config|
config.roles = { guest: 0, support: 1, staff: 2, manager: 3, admin: 99 }
config.super_user_roles = [:admin]
config.guest_user_roles = [:guest]
config.user_class_name = "AdminUser"
config.default_state = :cannot
end
config/initializers/active_admin.rb :-
ActiveAdmin.setup do |config|
config.site_title = 'Project'
config.site_title_image = 'logo.png'
meta_tags_options = { viewport: 'width=device-width, initial-scale=1' }
config.meta_tags = meta_tags_options
config.meta_tags_for_logged_out_pages = meta_tags_options
config.authentication_method = :authenticate_admin_user!
CanCanAdapter or make your own. Please refer to documentation.
config.authorization_adapter = ActiveAdmin::CanCanAdapter
You can customize your CanCan Ability class name here.
config.cancan_ability_class = "Ability"
config.current_user_method = :current_admin_user
Default:
config.logout_link_path = :destroy_admin_user_session_path
config.comments = false
config.batch_actions = true
config.filter_attributes = %i[encrypted_password password password_confirmation]
config.localize_format = :long
ability.rb
class Ability
include CanCan::Ability
include ActiveAdminRole::CanCan::Ability
def initialize(user)
user ||= AdminUser.new
end
end
The text was updated successfully, but these errors were encountered: