-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Don't force displayname if backend already provides one #3507
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
Don't force displayname if backend already provides one #3507
Conversation
|
The SAML app will have integration tests for this. Am currently working on it at https://github.com/nextcloud/user_saml/compare/attributes-to-map-for. |
blizzz
left a comment
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.
Has potential
lib/private/legacy/user.php
Outdated
| if (self::getUser() !== $uid) { | ||
| self::setUserId($uid); | ||
| self::setDisplayName($uid); | ||
| $setDisplayName = true; |
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.
var name is not very clear. My suggestion is to rename to "setUidAsDisplayName" or "useUidAsDisplayName"
lib/private/legacy/user.php
Outdated
| && $backend->implementsActions(OC_User_Backend::GET_DISPLAYNAME)) { | ||
|
|
||
| $backendDisplayName = $backend->getDisplayName($uid); | ||
| if(is_string($backendDisplayName) && $backendDisplayName !== '') { |
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.
trim($backendDisplayName) !== '', just in case?
`\OC_User::loginWithApache` is used in combination with backend mechanisms like our SSO / SAML integration. Those can optionally already provide a displayname using other means. For example by mapping SAML attributes. The current approach makes it however impossible for backends using `\OCP\Authentication\IApacheBackend` to set a displayname on their own. Because the display name will simply be overwritten with the loginname. Signed-off-by: Lukas Reschke <[email protected]>
3dd6379 to
92c74d2
Compare
|
@blizzz Adjusted 😉 |
|
Just tested the patch with git latest (server+user_saml) - works as expected. 2 side notes:
|
\OC_User::loginWithApacheis used in combination with backend mechanisms like our SSO / SAML integration. Those can optionally already provide a displayname using other means. For example by mapping SAML attributes.The current approach makes it however impossible for backends using
\OCP\Authentication\IApacheBackendto set a displayname on their own. Because the display name will simply be overwritten with the loginname.Signed-off-by: Lukas Reschke [email protected]