mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-11-10 00:11:22 +08:00
Merge pull request #8779 from artoscinote/ma_SCI_12222
Fix role reset for team assignments on PET [SCI-12222]
This commit is contained in:
commit
149d6cbefe
4 changed files with 8 additions and 4 deletions
|
|
@ -75,6 +75,8 @@ module AccessPermissions
|
||||||
end
|
end
|
||||||
|
|
||||||
propagate_job
|
propagate_job
|
||||||
|
|
||||||
|
render json: { user_role_id: @assignment.user_role_id }, status: :ok
|
||||||
rescue ActiveRecord::RecordInvalid
|
rescue ActiveRecord::RecordInvalid
|
||||||
render json: { flash: t('access_permissions.update.failure') }, status: :unprocessable_entity
|
render json: { flash: t('access_permissions.update.failure') }, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ module AccessPermissions
|
||||||
def update
|
def update
|
||||||
if permitted_params[:user_role_id] == 'reset'
|
if permitted_params[:user_role_id] == 'reset'
|
||||||
parent_assignment = @project.public_send(:"#{assignment_type}_assignments").find_or_initialize_by(
|
parent_assignment = @project.public_send(:"#{assignment_type}_assignments").find_or_initialize_by(
|
||||||
"#{assignment_type}_id": permitted_params[:"#{assignment_type}_id"],
|
"#{assignment_type}_id": permitted_params[:"#{assignment_type}_id"] || current_team.id,
|
||||||
team: current_team
|
team: current_team
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -35,7 +35,7 @@ module AccessPermissions
|
||||||
log_activity(:change_user_role_on_experiment, user_target: @assignment.user.id, role: @assignment.user_role.name)
|
log_activity(:change_user_role_on_experiment, user_target: @assignment.user.id, role: @assignment.user_role.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
render json: {}, status: :ok
|
render json: { user_role_id: @assignment.user_role_id }, status: :ok
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ module AccessPermissions
|
||||||
def update
|
def update
|
||||||
if permitted_params[:user_role_id] == 'reset'
|
if permitted_params[:user_role_id] == 'reset'
|
||||||
parent_assignment = @experiment.public_send(:"#{assignment_type}_assignments").find_or_initialize_by(
|
parent_assignment = @experiment.public_send(:"#{assignment_type}_assignments").find_or_initialize_by(
|
||||||
"#{assignment_type}_id": permitted_params[:"#{assignment_type}_id"],
|
"#{assignment_type}_id": permitted_params[:"#{assignment_type}_id"] || current_team.id,
|
||||||
team: current_team
|
team: current_team
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -33,6 +33,8 @@ module AccessPermissions
|
||||||
when :user
|
when :user
|
||||||
log_activity(:change_user_role_on_my_module, user_target: @assignment.user.id, role: @assignment.user_role.name)
|
log_activity(:change_user_role_on_my_module, user_target: @assignment.user.id, role: @assignment.user_role.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
render json: { user_role_id: @assignment.user_role_id }, status: :ok
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
||||||
|
|
@ -329,7 +329,7 @@ export default {
|
||||||
if (!roleId) {
|
if (!roleId) {
|
||||||
this.$emit('changeVisibility', false, null);
|
this.$emit('changeVisibility', false, null);
|
||||||
} else {
|
} else {
|
||||||
this.$emit('changeVisibility', true, roleId);
|
this.$emit('changeVisibility', true, response.data.user_role_id);
|
||||||
}
|
}
|
||||||
if (response.data.message) {
|
if (response.data.message) {
|
||||||
HelperModule.flashAlertMsg(response.data.message, 'success');
|
HelperModule.flashAlertMsg(response.data.message, 'success');
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue