diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-06 13:27:01 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-06 13:27:01 +0100 |
commit | 69a4cd2898d8b65257ccd1e526a4c3baad386a31 (patch) | |
tree | 0c3d61efde1dc0e090b13f68cc2b2a0ef3f0f15d /apps/user_ldap/lib/access.php | |
parent | 5832178f591f1efca48e06c78dfb7a0405a7cce4 (diff) | |
parent | c1871f5787cd48eb1e116f7f62bc4d4a50a0a04b (diff) | |
download | nextcloud-server-69a4cd2898d8b65257ccd1e526a4c3baad386a31.tar.gz nextcloud-server-69a4cd2898d8b65257ccd1e526a4c3baad386a31.zip |
Merge pull request #22102 from owncloud/ldap_2nddispname-master
[LDAP] add second field for additional/optional display name attribute
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; } |