Skip to content

Commit b78d2fc

Browse files
committed
fix: always use display name from correct backend
Overwrite the display name after the account is initialized when using an instacne of IGetDisplayNameBackend. Before when using a variation of user_oidc and registering a Backend.php implementing IGetDisplayNameBackend the personal setting page shows 'uid'. The UserManager/AccountManager seems not to use consistently the correct backend. The correct backend is used in this sequence: server/lib/private/TemplateLayout.php $userDisplayName = \OC_User::getDisplayName(); $this->assign(user_displayname, $userDisplayName); In the settings page, it definitely not calls the registered backend, but seems to fall back to default Backend and shows (usually) uid or a value from the standard account property table. Signed-off-by: Max <[email protected]>
1 parent 5fcb19c commit b78d2fc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/private/Accounts/AccountManager.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
use OCP\Mail\IMailer;
6363
use OCP\Security\ICrypto;
6464
use OCP\Security\VerificationToken\IVerificationToken;
65+
use OCP\User\Backend\IGetDisplayNameBackend;
6566
use OCP\Util;
6667
use Psr\Log\LoggerInterface;
6768
use function array_flip;
@@ -744,6 +745,10 @@ public function getAccount(IUser $user): IAccount {
744745
return $cached;
745746
}
746747
$account = $this->parseAccountData($user, $this->getUser($user));
748+
if ($user->getBackend() instanceof IGetDisplayNameBackend) {
749+
$propery = $account->getProperty(self::PROPERTY_DISPLAYNAME);
750+
$account->setProperty(self::PROPERTY_DISPLAYNAME, $user->getDisplayName(), $propery->getScope(), $property->getVerified(), $property->getVerificationData());
751+
}
747752
$this->internalCache->set($user->getUID(), $account);
748753
return $account;
749754
}

0 commit comments

Comments
 (0)