From 3d786f8df65f35d636bec6d3e604ced032a0886d Mon Sep 17 00:00:00 2001 From: Pierre Ozoux Date: Mon, 2 May 2022 14:51:53 +0200 Subject: [PATCH] Implements group update. --- lib/Controller/GroupController.php | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/lib/Controller/GroupController.php b/lib/Controller/GroupController.php index 1dd44a2..044e3fe 100644 --- a/lib/Controller/GroupController.php +++ b/lib/Controller/GroupController.php @@ -175,30 +175,21 @@ class GroupController extends ASCIMGroup { * * @param string $id * - * @param bool $active * @param string $displayName - * @param array $emails + * @param array $members * @return DataResponse * @throws Exception */ public function update( string $id, - bool $active, string $displayName = '', - array $emails = []): SCIMJSONResponse { - $targetUser = $this->userManager->get($id); - if ($targetUser === null) { - return new SCIMErrorResponse(['message' => 'User not found'], 404); + array $members = []): SCIMJSONResponse { + $group = $this->groupManager->get($id); + foreach ($members as $member) { + $targetUser = $this->userManager->get($member['value']); + $group->addUser($targetUser); + // todo implement member removal (: } - foreach ($emails as $email) { - if ($email['primary'] === true) { - $targetUser->setEMailAddress($email['value']); - } - } - if (isset($active)) { - $targetUser->setEnabled($active); - } - return new SCIMJSONResponse($this->getSCIMUser($id)); - + return new SCIMJSONResponse($this->getSCIMGroup($id)); } /**