Implements attribute active.
This commit is contained in:
parent
ace615aa97
commit
d369661b8c
2 changed files with 9 additions and 3 deletions
|
@ -88,6 +88,8 @@ abstract class ASCIMUser extends ApiController {
|
|||
throw new SCIMException('User not found', 404);
|
||||
}
|
||||
|
||||
$enabled = $this->config->getUserValue($targetUserObject->getUID(), 'core', 'enabled', 'true') === 'true';
|
||||
|
||||
return [
|
||||
'schemas' => ["urn:ietf:params:scim:schemas:core:2.0:User"],
|
||||
'id' => $userId,
|
||||
|
@ -106,7 +108,7 @@ abstract class ASCIMUser extends ApiController {
|
|||
]
|
||||
],
|
||||
//'groups' => [],
|
||||
'active' => (bool) $this->config->getUserValue($userId, 'core', 'enabled', 'true') === 'true'
|
||||
'active' => $enabled
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -157,9 +157,9 @@ class UserController extends ASCIMUser {
|
|||
* @return SCIMResourceResponse
|
||||
* @throws SCIMException
|
||||
*/
|
||||
public function create( bool $active = true,
|
||||
public function create( bool $active = true,
|
||||
string $displayName = '',
|
||||
array $emails = [],
|
||||
array $emails = [],
|
||||
string $userName = ''): SCIMResourceResponse {
|
||||
if ($this->userManager->userExists($userName)) {
|
||||
$this->logger->error('Failed createUser attempt: User already exists.', ['app' => 'SCIMServiceProvider']);
|
||||
|
@ -175,6 +175,7 @@ class UserController extends ASCIMUser {
|
|||
$newUser->setEMailAddress($email['value']);
|
||||
}
|
||||
}
|
||||
$newUser->setEnabled($active);
|
||||
return new SCIMResourceResponse($this->getSCIMUser($userName));
|
||||
} catch (SCIMException $e) {
|
||||
$this->logger->warning('Failed createUser attempt with SCIMException exeption.', ['app' => 'SCIMServiceProvider']);
|
||||
|
@ -207,6 +208,9 @@ class UserController extends ASCIMUser {
|
|||
$targetUser->setEMailAddress($email['value']);
|
||||
}
|
||||
}
|
||||
if (isset($active)) {
|
||||
$targetUser->setEnabled($active);
|
||||
}
|
||||
return new SCIMResourceResponse($this->getSCIMUser($id));
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue