1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00

fix user import from sso

A bug was introduced by detailed debug logs
This commit is contained in:
Sylvain 2021-12-20 13:41:40 +01:00
parent 3a787ea2a0
commit 587beb01ab

View File

@ -324,13 +324,18 @@ class User < ApplicationRecord
end
# run the account transfer in an SQL transaction to ensure data integrity
User.transaction do
# remove the temporary account
logger.debug 'removing the temporary user'
sso_user.destroy
# finally, save the new details
logger.debug 'saving the updated user'
logger.error "unable to save the user, an error occurred : #{errors.full_messages.join(', ')}" unless save!
begin
User.transaction do
# remove the temporary account
logger.debug 'removing the temporary user'
sso_user.destroy
# finally, save the new details
logger.debug 'saving the updated user'
save!
end
rescue ActiveRecord::RecordInvalid => e
logger.error "error while merging user #{sso_user.id} into #{id}: #{e.message}"
raise e
end
end