diff options
Diffstat (limited to 'apps/provisioning_api/lib')
-rw-r--r-- | apps/provisioning_api/lib/Controller/UsersController.php | 8 |
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 { |