Skip to content

Commit

Permalink
Merge branch 'MDL-63207-311' of git://github.com/cescobedo/moodle int…
Browse files Browse the repository at this point in the history
…o MOODLE_311_STABLE
  • Loading branch information
stronk7 committed Sep 9, 2021
2 parents fec2e6c + 4bd73ec commit b1216ee
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions auth/ldap/auth.php
Expand Up @@ -1228,15 +1228,16 @@ 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];
Expand Down

0 comments on commit b1216ee

Please sign in to comment.