Skip to content

Commit

Permalink
Merge branch 'MDL-63207-master' of git://github.com/cescobedo/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Sep 9, 2021
2 parents 633c2fc + 53b9dbd commit 69cdde9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
20 changes: 10 additions & 10 deletions auth/ldap/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -1242,18 +1242,18 @@ function user_update($olduser, $newuser) {
empty($nuvalue) ? $nuvalue = array() : $nuvalue;
$ouvalue = core_text::convert($oldvalue, 'utf-8', $this->config->ldapencoding);
foreach ($ldapkeys as $ldapkey) {
// Skip update if $ldapkey does not exist in LDAP.
if (!isset($user_entry[$ldapkey][0])) {
$success = false;
error_log($this->errorlogtag.get_string('updateremfailfield', 'auth_ldap',
array('ldapkey' => $ldapkey,
'key' => $key,
'ouvalue' => $ouvalue,
'nuvalue' => $nuvalue)));
continue;
// If the field is empty in LDAP there are two options:
// 1. We get the LDAP field using ldap_first_attribute.
// 2. LDAP don't send the field using ldap_first_attribute.
// So, for option 1 we check the if the field is retrieve it.
// And get the original value of field in LDAP if the field.
// Otherwise, let value in blank and delegate the check in ldap_modify.
if (isset($user_entry[$ldapkey][0])) {
$ldapvalue = $user_entry[$ldapkey][0];
} else {
$ldapvalue = '';
}

$ldapvalue = $user_entry[$ldapkey][0];
if (!$ambiguous) {
// Skip update if the values already match
if ($nuvalue !== $ldapvalue) {
Expand Down
1 change: 0 additions & 1 deletion auth/ldap/lang/en/auth_ldap.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@
$string['start_tls_key'] = 'Use TLS';
$string['updateremfail'] = 'Error updating LDAP record. Error code: {$a->errno}; Error string: {$a->errstring}<br/>Key ({$a->key}) - old moodle value: \'{$a->ouvalue}\' new value: \'{$a->nuvalue}\'';
$string['updateremfailamb'] = 'Failed to update LDAP with ambiguous field {$a->key}; old moodle value: \'{$a->ouvalue}\', new value: \'{$a->nuvalue}\'';
$string['updateremfailfield'] = 'Failed to update LDAP with non-existent field (\'{$a->ldapkey}\'). Key ({$a->key}) - old Moodle value: \'{$a->ouvalue}\' new value: \'{$a->nuvalue}\'';
$string['updatepasserror'] = 'Error in user_update_password(). Error code: {$a->errno}; Error string: {$a->errstring}';
$string['updatepasserrorexpire'] = 'Error in user_update_password() when reading password expiry time. Error code: {$a->errno}; Error string: {$a->errstring}';
$string['updatepasserrorexpiregrace'] = 'Error in user_update_password() when modifying expiry time and/or grace logins. Error code: {$a->errno}; Error string: {$a->errstring}';
Expand Down

0 comments on commit 69cdde9

Please sign in to comment.