Claim to always support \OC\User\Backend::GET_DISPLAYNAME

`\OC_User::loginWithApache` sets the display name otherwise to the login name which is wrong.

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
Lukas Reschke 2017-07-31 15:44:34 +02:00
parent d187271f81
commit 034e2d7c8a
No known key found for this signature in database
GPG key ID: B9F6980CF6E759B1

View file

@ -116,12 +116,7 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
*/
public function implementsActions($actions) {
$availableActions = \OC\User\Backend::CHECK_PASSWORD;
if($this->autoprovisionAllowed()
&& $this->config->getAppValue('user_saml', 'saml-attribute-mapping-displayName_mapping', '') !== '') {
$availableActions |= \OC\User\Backend::GET_DISPLAYNAME;
}
$availableActions |= \OC\User\Backend::GET_DISPLAYNAME;
return (bool)($availableActions & $actions);
}
@ -413,7 +408,7 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
private function getAttributeValue($name, array $attributes) {
$keys = explode(' ', $this->config->getAppValue('user_saml', $name, ''));
if(count($keys) === 1 && $keys[1] === '') {
if(count($keys) === 1 && $keys[0] === '') {
throw new \InvalidArgumentException('Attribute is not configured');
}
@ -460,7 +455,7 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
$currentDisplayname = (string)$this->getDisplayName($uid);
if($newDisplayname !== null
&& $currentDisplayname !== $newDisplayname) {
$this->setDisplayName($uid, $newDisplayname);
$user->setDisplayName($newDisplayname);
}
}
}