summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2017-02-16 14:20:06 +0100
committerGitHub <noreply@github.com>2017-02-16 14:20:06 +0100
commitcdc48d301e3d4b8ad77e5e279f240ac1d441f252 (patch)
tree7fd2671bf2eb5c7d44c28d6134bc71c5223dfede
parentf25c89461c986b31171270e2186d000030b8df2e (diff)
parent92c74d2f9a4e916d1ea861c6959c8807e9944b46 (diff)
downloadnextcloud-server-cdc48d301e3d4b8ad77e5e279f240ac1d441f252.tar.gz
nextcloud-server-cdc48d301e3d4b8ad77e5e279f240ac1d441f252.zip
Merge pull request #3507 from nextcloud/if-backend-implements-get-display-name-dont-force-one
Don't force displayname if backend already provides one
-rw-r--r--lib/private/legacy/user.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/private/legacy/user.php b/lib/private/legacy/user.php
index 0a52be7565d..661242a659a 100644
--- a/lib/private/legacy/user.php
+++ b/lib/private/legacy/user.php
@@ -187,7 +187,18 @@ class OC_User {
if ($uid) {
if (self::getUser() !== $uid) {
self::setUserId($uid);
- self::setDisplayName($uid);
+ $setUidAsDisplayName = true;
+ if($backend instanceof \OCP\UserInterface
+ && $backend->implementsActions(OC_User_Backend::GET_DISPLAYNAME)) {
+
+ $backendDisplayName = $backend->getDisplayName($uid);
+ if(is_string($backendDisplayName) && trim($backendDisplayName) !== '') {
+ $setUidAsDisplayName = false;
+ }
+ }
+ if($setUidAsDisplayName) {
+ self::setDisplayName($uid);
+ }
self::getUserSession()->setLoginName($uid);
$request = OC::$server->getRequest();
self::getUserSession()->createSessionToken($request, $uid, $uid);