diff options
Diffstat (limited to 'apps/user_ldap/lib/access.php')
-rw-r--r-- | apps/user_ldap/lib/access.php | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php index 82cd342ae2f..16b942084c4 100644 --- a/apps/user_ldap/lib/access.php +++ b/apps/user_ldap/lib/access.php @@ -521,6 +521,7 @@ class Access extends LDAPUtility implements user\IUserTools { private function ldap2ownCloudNames($ldapObjects, $isUsers) { if($isUsers) { $nameAttribute = $this->connection->ldapUserDisplayName; + $sndAttribute = $this->connection->ldapUserDisplayName2; } else { $nameAttribute = $this->connection->ldapGroupDisplayName; } @@ -542,13 +543,14 @@ class Access extends LDAPUtility implements user\IUserTools { if($isUsers) { //cache the user names so it does not need to be retrieved //again later (e.g. sharing dialogue). - $this->cacheUserExists($ocName); - if(!is_null($nameByLDAP)) { - $this->cacheUserDisplayName($ocName, $nameByLDAP); + if(is_null($nameByLDAP)) { + continue; } + $sndName = isset($ldapObject[$sndAttribute]) + ? $ldapObject[$sndAttribute] : ''; + $this->cacheUserDisplayName($ocName, $nameByLDAP, $sndName); } } - continue; } return $ownCloudNames; } @@ -575,8 +577,11 @@ class Access extends LDAPUtility implements user\IUserTools { * caches the user display name * @param string $ocName the internal ownCloud username * @param string $displayName the display name + * @param string $displayName2 the second display name */ - public function cacheUserDisplayName($ocName, $displayName) { + public function cacheUserDisplayName($ocName, $displayName, $displayName2 = '') { + $user = $this->userManager->get($ocName); + $displayName = $user->composeAndStoreDisplayName($displayName, $displayName2); $cacheKeyTrunk = 'getDisplayName'; $this->connection->writeToCache($cacheKeyTrunk.$ocName, $displayName); } @@ -1300,7 +1305,7 @@ class Access extends LDAPUtility implements user\IUserTools { return false; } $result=$testConnection->bind(); - $this->connection->bind(); + $this->ldap->unbind($this->connection->getConnectionResource()); return $result; } |