diff --git a/app/helpers/user_roles_helper.rb b/app/helpers/user_roles_helper.rb index 9ebc9b252..a8a16828a 100644 --- a/app/helpers/user_roles_helper.rb +++ b/app/helpers/user_roles_helper.rb @@ -2,9 +2,7 @@ module UserRolesHelper def user_roles_collection - Rails.cache.fetch([current_user, 'available_user_roles']) do - @user_roles_collection ||= UserRole.order(id: :asc).pluck(:name, :id) - end + UserRole.order(id: :asc).pluck(:name, :id) end def team_user_roles_collection @@ -17,6 +15,10 @@ module UserRolesHelper .reverse! end + def team_user_roles_for_select + team_user_roles_collection.pluck(:name, :id) + end + def managing_team_user_roles_collection UserRole.where('permissions && ARRAY[?]::varchar[]', [TeamPermissions::USERS_MANAGE]) end diff --git a/app/models/user_role.rb b/app/models/user_role.rb index a443de076..b8ec61394 100644 --- a/app/models/user_role.rb +++ b/app/models/user_role.rb @@ -53,6 +53,10 @@ class UserRole < ApplicationRecord predefined.find_by(name: UserRole.public_send('owner_role').name) end + def self.find_predefined_normal_user_role + predefined.find_by(name: UserRole.public_send('normal_user_role').name) + end + def owner? name == I18n.t('user_roles.predefined.owner') end diff --git a/app/views/shared/_invite_users_modal.html.erb b/app/views/shared/_invite_users_modal.html.erb index 80959c47e..4c94e2ed9 100644 --- a/app/views/shared/_invite_users_modal.html.erb +++ b/app/views/shared/_invite_users_modal.html.erb @@ -113,11 +113,13 @@ invite_with_team_selector = type.in?(%w(invite_new_members invite_with_team_sele <%= t('invite_users.select_team_role') %>