Merge pull request #8656 from okriuchykhin/ok_SCI_12063

Update available users loading logic in access management base controller [SCI-12063]
This commit is contained in:
Martin Artnik 2025-07-15 10:45:39 +02:00 committed by GitHub
commit 9ff2a2ade8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,7 +8,7 @@ module AccessPermissions
before_action :set_assignment, only: %i(create update destroy)
before_action :check_read_permissions, only: %i(show show_user_group_assignments)
before_action :check_manage_permissions, except: %i(show show_user_group_assignments)
before_action :available_users, only: %i(new create)
before_action :load_available_users, only: %i(new create)
def show
render json: @model.user_assignments.includes(:user_role, :user).order('users.full_name ASC'),
@ -133,13 +133,8 @@ module AccessPermissions
.permit(%i(user_role_id user_id user_group_id team_id))
end
def available_users
# automatically assigned or not assigned to project
@available_users = current_team.users.where(
id: @model.user_assignments.automatically_assigned.select(:user_id)
).or(
current_team.users.where.not(id: @model.users.select(:id))
).order('users.full_name ASC')
def load_available_users
@available_users = current_team.users.where.not(id: @model.users.select(:id)).order(users: { full_name: :asc })
end
def propagate_job(destroy: false)