From ba53bf48a74f9d96c52c2ae0aa23139696d3acfd Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Tue, 15 Mar 2022 17:06:20 +0000 Subject: [PATCH] MDL-57383 tool_uploaduser: don't overwrite auth during update. If updating users during upload along with the option to fill in missing fields from file content, then we should exclude the auth column because it will always be present for a user. --- admin/tool/uploaduser/classes/process.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/admin/tool/uploaduser/classes/process.php b/admin/tool/uploaduser/classes/process.php index 82f05910d34..70913f91cd9 100644 --- a/admin/tool/uploaduser/classes/process.php +++ b/admin/tool/uploaduser/classes/process.php @@ -692,7 +692,11 @@ class process { $dologout = false; if ($this->get_update_type() != UU_UPDATE_NOCHANGES and !$remoteuser) { - if (!empty($user->auth) and $user->auth !== $existinguser->auth) { + + // Handle 'auth' column separately, the field can never be missing from a user. + if (!empty($user->auth) && ($user->auth !== $existinguser->auth) && + ($this->get_update_type() != UU_UPDATE_MISSING)) { + $this->upt->track('auth', s($existinguser->auth).'-->'.s($user->auth), 'info', false); $existinguser->auth = $user->auth; if (!isset($this->supportedauths[$user->auth])) {