Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Don't force displayname if backend already provides one
`\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]>
  • Loading branch information
LukasReschke committed Feb 16, 2017
commit 92c74d2f9a4e916d1ea861c6959c8807e9944b46
13 changes: 12 additions & 1 deletion lib/private/legacy/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,18 @@ public static function loginWithApache(\OCP\Authentication\IApacheBackend $backe
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);
Expand Down