Permalink
Browse files

auth/ldap: Fixed handling of multi-source field mapping. Now fields w…

…ith 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.
  • Loading branch information...
1 parent 289cf90 commit 2a069aa1f2d11bb5d4a9dc899ac8f48f5bf93bc6 martinlanghoff committed Aug 25, 2005
Showing with 7 additions and 3 deletions.
  1. +7 −3 auth/ldap/lib.php
View
@@ -124,15 +124,19 @@ function auth_get_userinfo($username){
if (!is_array($values)) {
$values = array($values);
}
+ $ldapval = NULL;
foreach ($values as $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 {
- $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;
}
}

0 comments on commit 2a069aa

Please sign in to comment.