diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2016-02-03 13:16:55 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2016-02-03 13:55:39 +0100 |
commit | c1871f5787cd48eb1e116f7f62bc4d4a50a0a04b (patch) | |
tree | aaae91d24fb00638429b1122396a0f3dbb0d129a /apps/user_ldap/lib/user/user.php | |
parent | 621f54da514af548bf900f7a1c64af046f53b86d (diff) | |
download | nextcloud-server-c1871f5787cd48eb1e116f7f62bc4d4a50a0a04b.tar.gz nextcloud-server-c1871f5787cd48eb1e116f7f62bc4d4a50a0a04b.zip |
Port of test_ldap_2nddispname to master
Diffstat (limited to 'apps/user_ldap/lib/user/user.php')
-rw-r--r-- | apps/user_ldap/lib/user/user.php | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/apps/user_ldap/lib/user/user.php b/apps/user_ldap/lib/user/user.php index 13f88aa6507..3bc790a6c10 100644 --- a/apps/user_ldap/lib/user/user.php +++ b/apps/user_ldap/lib/user/user.php @@ -168,13 +168,22 @@ class User { unset($attr); //displayName + $displayName = $displayName2 = ''; $attr = strtolower($this->connection->ldapUserDisplayName); if(isset($ldapEntry[$attr])) { $displayName = $ldapEntry[$attr][0]; - if(!empty($displayName)) { - $this->storeDisplayName($displayName); - $this->access->cacheUserDisplayName($this->getUsername(), $displayName); - } + } + $attr = strtolower($this->connection->ldapUserDisplayName2); + if(isset($ldapEntry[$attr])) { + $displayName2 = $ldapEntry[$attr][0]; + } + if(!empty($displayName)) { + $this->composeAndStoreDisplayName($displayName); + $this->access->cacheUserDisplayName( + $this->getUsername(), + $displayName, + $displayName2 + ); } unset($attr); @@ -350,6 +359,7 @@ class User { /** * Stores a key-value pair in relation to this user + * * @param string $key * @param string $value */ @@ -358,11 +368,19 @@ class User { } /** - * Stores the display name in the databae + * Composes the display name and stores it in the database. The final + * display name is returned. + * * @param string $displayName + * @param string $displayName2 + * @returns string the effective display name */ - public function storeDisplayName($displayName) { + public function composeAndStoreDisplayName($displayName, $displayName2 = '') { + if(!empty($displayName2)) { + $displayName .= ' (' . $displayName2 . ')'; + } $this->store('displayName', $displayName); + return $displayName; } /** |