Module: Decidim::Admin::UserRolesHelper

Included in:
ApplicationHelper
Defined in:
app/helpers/decidim/admin/user_roles_helper.rb

Instance Method Summary collapse

Instance Method Details

#user_role_configObject



6
7
8
9
10
11
12
13
14
15
16
# File 'app/helpers/decidim/admin/user_roles_helper.rb', line 6

def user_role_config
  return @user_role_config if @user_role_config

  space = current_participatory_space
  @user_role_config = if current_user.admin?
                        space.user_role_config_for(current_user, :organization_admin)
                      else
                        role = space.user_roles.find_by(user: current_user)
                        space.user_role_config_for(current_user, role&.role)
                      end
end