From ff99a05ccd9767172a51320c09d73bd9dd34b6fd Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Wed, 30 Jun 2021 00:26:23 +0200 Subject: [PATCH] fix small issues in UsersController handling Signed-off-by: Arthur Schiwon --- apps/provisioning_api/lib/Controller/AUserData.php | 2 +- apps/provisioning_api/lib/Controller/UsersController.php | 8 ++++++-- build/integration/features/bootstrap/Provisioning.php | 3 --- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/provisioning_api/lib/Controller/AUserData.php b/apps/provisioning_api/lib/Controller/AUserData.php index 8069fcb4da52a..e358d28206186 100644 --- a/apps/provisioning_api/lib/Controller/AUserData.php +++ b/apps/provisioning_api/lib/Controller/AUserData.php @@ -156,7 +156,7 @@ protected function getUserData(string $userId, bool $includeScopes = false): arr foreach ($emailCollection->getProperties() as $property) { $additionalEmails[] = $property->getValue(); if ($includeScopes) { - $additionalEmailScopes = $property->getScope(); + $additionalEmailScopes[] = $property->getScope(); } } $data[IAccountManager::COLLECTION_EMAIL] = $additionalEmails; diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php index f5993e3aa5c03..b81801aba285a 100644 --- a/apps/provisioning_api/lib/Controller/UsersController.php +++ b/apps/provisioning_api/lib/Controller/UsersController.php @@ -673,8 +673,12 @@ public function editUserMultiValue( } } if ($targetProperty instanceof IAccountProperty) { - $targetProperty->setScope($value); - $this->accountManager->updateAccount($userAccount); + try { + $targetProperty->setScope($value); + $this->accountManager->updateAccount($userAccount); + } catch (\InvalidArgumentException $e) { + throw new OCSException('', 102); + } } else { throw new OCSException('', 102); } diff --git a/build/integration/features/bootstrap/Provisioning.php b/build/integration/features/bootstrap/Provisioning.php index ad22925eddffe..e51339c081e02 100644 --- a/build/integration/features/bootstrap/Provisioning.php +++ b/build/integration/features/bootstrap/Provisioning.php @@ -168,9 +168,6 @@ public function userHasSetting($user, $settings) { $response = $client->get($fullUrl, $options); foreach ($settings->getRows() as $setting) { $value = json_decode(json_encode(simplexml_load_string($response->getBody())->data->{$setting[0]}), 1); - if (in_array($setting[0], ['additional_mail', 'additional_mailScope'], true)) { - var_dump($value); - } if (isset($value['element']) && in_array($setting[0], ['additional_mail', 'additional_mailScope'], true)) { $expectedValues = explode(';', $setting[1]); foreach ($expectedValues as $expected) {