mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
Merged from MOODLE_15_STABLE - auth/ldap: Fixed handling of multi-source field mapping. Now fields with non-empty values have precedence over empty fields, regardless of order. Fields will be set to empty only if all ldap source fields are empty.
This commit is contained in:
parent
5b66416fe9
commit
b8a0a101e5
@ -124,15 +124,19 @@ function auth_get_userinfo($username){
|
|||||||
if (!is_array($values)) {
|
if (!is_array($values)) {
|
||||||
$values = array($values);
|
$values = array($values);
|
||||||
}
|
}
|
||||||
|
$ldapval = NULL;
|
||||||
foreach ($values as $value) {
|
foreach ($values as $value) {
|
||||||
if(is_array($user_entry[0][strtolower($value)])) {
|
if(is_array($user_entry[0][strtolower($value)])) {
|
||||||
$result[$key]=addslashes(stripslashes(utf8_decode($user_entry[0][strtolower($value)][0])));
|
$newval = addslashes(stripslashes(utf8_decode($user_entry[0][strtolower($value)][0])));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$result[$key] = addslashes(stripslashes(utf8_decode($user_entry[0][strtolower($value)])));
|
$newval = addslashes(stripslashes(utf8_decode($user_entry[0][strtolower($value)])));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (!empty($newval)) { // favour ldap entries that are set
|
||||||
|
$ldapval = $newval;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$result[$key] = $ldapval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user