aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/user_ldap/lib/User_LDAP.php41
-rw-r--r--lib/private/User/User.php2
2 files changed, 3 insertions, 40 deletions
diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php
index d787bfea4d4..9c7c4bca93b 100644
--- a/apps/user_ldap/lib/User_LDAP.php
+++ b/apps/user_ldap/lib/User_LDAP.php
@@ -461,7 +461,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I
/**
* get display name of the user
* @param string $uid user ID of the user
- * @return string|false display name
+ * @return ?string|false display name
*/
public function getDisplayName($uid) {
if ($this->userPluginManager->implementsActions(Backend::GET_DISPLAYNAME)) {
@@ -472,44 +472,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I
return false;
}
- $cacheKey = 'getDisplayName'.$uid;
- if (!is_null($displayName = $this->access->connection->getFromCache($cacheKey))) {
- return $displayName;
- }
-
- //Check whether the display name is configured to have a 2nd feature
- $additionalAttribute = $this->access->connection->ldapUserDisplayName2;
- $displayName2 = '';
- if ($additionalAttribute !== '') {
- $displayName2 = $this->access->readAttribute(
- $this->access->username2dn($uid),
- $additionalAttribute);
- }
-
- $displayName = $this->access->readAttribute(
- $this->access->username2dn($uid),
- $this->access->connection->ldapUserDisplayName);
-
- if ($displayName && (count($displayName) > 0)) {
- $displayName = $displayName[0];
-
- if (is_array($displayName2)) {
- $displayName2 = count($displayName2) > 0 ? $displayName2[0] : '';
- }
-
- $user = $this->access->userManager->get($uid);
- if ($user instanceof User) {
- $displayName = $user->composeAndStoreDisplayName($displayName, $displayName2);
- $this->access->connection->writeToCache($cacheKey, $displayName);
- }
- if ($user instanceof OfflineUser) {
- /** @var OfflineUser $user*/
- $displayName = $user->getDisplayName();
- }
- return $displayName;
- }
-
- return null;
+ return $this->ocConfig->getUserValue($uid, 'user_ldap', 'displayName', null);
}
/**
diff --git a/lib/private/User/User.php b/lib/private/User/User.php
index 580c590e6eb..a53d84794fd 100644
--- a/lib/private/User/User.php
+++ b/lib/private/User/User.php
@@ -145,7 +145,7 @@ class User implements IUser {
if (!empty($displayName)) {
$this->displayName = $displayName;
} else {
- $this->displayName = $this->uid;
+ return $this->uid;
}
}
return $this->displayName;