aboutsummaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api/lib/Controller
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-03-24 12:32:12 +0100
committerJoas Schilling <coding@schilljs.com>2023-04-26 08:41:37 +0200
commit1c0aae9c54a01c33cb32373b8a455b932ec25829 (patch)
tree5dc116a4f3d90d347403d6b048d4b3ee42d5294c /apps/provisioning_api/lib/Controller
parent278f6413c9ee6d5c011c59a81d2f8e24a86dfbac (diff)
downloadnextcloud-server-1c0aae9c54a01c33cb32373b8a455b932ec25829.tar.gz
nextcloud-server-1c0aae9c54a01c33cb32373b8a455b932ec25829.zip
fix(provisioning_api): Don't allow to configure the same additional email multiple times
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/provisioning_api/lib/Controller')
-rw-r--r--apps/provisioning_api/lib/Controller/UsersController.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php
index bc97e32faa4..b005acc4d7f 100644
--- a/apps/provisioning_api/lib/Controller/UsersController.php
+++ b/apps/provisioning_api/lib/Controller/UsersController.php
@@ -942,11 +942,11 @@ class UsersController extends AUserData {
if (filter_var($value, FILTER_VALIDATE_EMAIL) && $value !== $targetUser->getSystemEMailAddress()) {
$userAccount = $this->accountManager->getAccount($targetUser);
$mailCollection = $userAccount->getPropertyCollection(IAccountManager::COLLECTION_EMAIL);
- foreach ($mailCollection->getProperties() as $property) {
- if ($property->getValue() === $value) {
- break;
- }
+
+ if ($mailCollection->getPropertyByValue($value)) {
+ throw new OCSException('', 102);
}
+
$mailCollection->addPropertyWithDefaults($value);
$this->accountManager->updateAccount($userAccount);
} else {