diff options
author | Anna Larch <anna@nextcloud.com> | 2021-02-18 16:41:33 +0300 |
---|---|---|
committer | Anna Larch <anna@nextcloud.com> | 2021-02-19 11:41:41 +0300 |
commit | ebe98b47f7d8b89fea6356c661b54eb0548af605 (patch) | |
tree | c6e6cd259abff58fe11215905e1c68e8dea464a8 /lib/Service | |
parent | 324ddd3e0b4cce10da8f31172b91349170d214e9 (diff) |
Add delete command to OCC
Signed-off-by: Anna Larch <anna@nextcloud.com>
Diffstat (limited to 'lib/Service')
-rw-r--r-- | lib/Service/AccountService.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Service/AccountService.php b/lib/Service/AccountService.php index 90766e98c..13462ff2d 100644 --- a/lib/Service/AccountService.php +++ b/lib/Service/AccountService.php @@ -126,6 +126,21 @@ class AccountService { } /** + * @param int $accountId + * + * @throws ClientException + */ + public function deleteByAccountId(int $accountId): void { + try { + $mailAccount = $this->mapper->findById($accountId); + } catch (DoesNotExistException $e) { + throw new ClientException("Account $accountId does not exist", 0, $e); + } + $this->aliasesService->deleteAll($accountId); + $this->mapper->delete($mailAccount); + } + + /** * @param MailAccount $newAccount * @return MailAccount */ |