New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: always use display name from correct backend #39770
fix: always use display name from correct backend #39770
Conversation
c3058b0
to
cbc436e
Compare
Looks sane, one thing I'll still want to double check is if this properly propagates to the system addressbook |
cbc436e
to
136c804
Compare
@@ -744,6 +745,9 @@ public function getAccount(IUser $user): IAccount { | |||
return $cached; | |||
} | |||
$account = $this->parseAccountData($user, $this->getUser($user)); | |||
if ($user->getBackend() instanceof IGetDisplayNameBackend) { | |||
$account->setProperty(self::PROPERTY_DISPLAYNAME, $user->getDisplayName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay... so this would need a scope and verified parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can just take the existing scope/verified parameter from the account object obtained earlier i think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I now reuse the ones that were set on the original property from the account data as that mimics what the previous patch did.
I'm not sure that's what we want though. Given that we are getting the display name from the backend it's probably verified even if the display name in the original account data was not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we do not make any use of the verified parameter anyways for the displayname, the scope is user configured so it should be fine with this approach.
136c804
to
b78d2fc
Compare
b78d2fc
to
b72e979
Compare
b72e979
to
d3ce30c
Compare
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 <max@nextcloud.com>
d3ce30c
to
99a4a9c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍
Asking @Pytal and @ChristophWurst for review as I think both worked with that accounts code in the past |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense
/backport to stable27 |
/backport to stable26 |
/backport to stable25 |
The backport to stable26 failed. Please do this backport manually. # Switch to the target branch and update it
git checkout stable26
git pull origin stable26
# Create the new backport branch
git checkout -b fix/foo-stable26
# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts. Resolve them.
git cherry-pick abc123
# Push the cherry pick commit to the remote repository and open a pull request
git push origin fix/foo-stable26 More info at https://docs.nextcloud.com/server/latest/developer_manual/getting_started/development_process.html#manual-backport |
The backport to stable25 failed. Please do this backport manually. # Switch to the target branch and update it
git checkout stable25
git pull origin stable25
# Create the new backport branch
git checkout -b fix/foo-stable25
# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts. Resolve them.
git cherry-pick abc123
# Push the cherry pick commit to the remote repository and open a pull request
git push origin fix/foo-stable25 More info at https://docs.nextcloud.com/server/latest/developer_manual/getting_started/development_process.html#manual-backport |
Perfect. You helped me to save some nerves for the next release! |
@max-nextcloud Can you take care of the manual backports? |
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
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.
Summary
TODO
Checklist