diff options
author | Thomas Citharel <tcit@tcit.fr> | 2021-08-13 14:19:03 +0200 |
---|---|---|
committer | MichaIng <micha@dietpi.com> | 2021-11-18 15:46:00 +0100 |
commit | 6269efd2f1a0c6c478600226acbdd305bfaf82e9 (patch) | |
tree | 11c559b4b1d2bf9cf5422d0b0f2ee877ed701dfb /apps/dav/lib/HookManager.php | |
parent | 8a25826610a496244fa0cbd685229ca9507ae523 (diff) | |
download | nextcloud-server-6269efd2f1a0c6c478600226acbdd305bfaf82e9.tar.gz nextcloud-server-6269efd2f1a0c6c478600226acbdd305bfaf82e9.zip |
Delete calendar subscriptions as well when deleting user
Closes #28418
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Diffstat (limited to 'apps/dav/lib/HookManager.php')
-rw-r--r-- | apps/dav/lib/HookManager.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/apps/dav/lib/HookManager.php b/apps/dav/lib/HookManager.php index 558aad72c03..1cb6e604524 100644 --- a/apps/dav/lib/HookManager.php +++ b/apps/dav/lib/HookManager.php @@ -59,6 +59,9 @@ class HookManager { private $calendarsToDelete = []; /** @var array */ + private $subscriptionsToDelete = []; + + /** @var array */ private $addressBooksToDelete = []; /** @var EventDispatcherInterface */ @@ -112,9 +115,11 @@ class HookManager { public function preDeleteUser($params) { $uid = $params['uid']; + $userPrincipalUri = 'principals/users/' . $uid; $this->usersToDelete[$uid] = $this->userManager->get($uid); - $this->calendarsToDelete = $this->calDav->getUsersOwnCalendars('principals/users/' . $uid); - $this->addressBooksToDelete = $this->cardDav->getUsersOwnAddressBooks('principals/users/' . $uid); + $this->calendarsToDelete = $this->calDav->getUsersOwnCalendars($userPrincipalUri); + $this->subscriptionsToDelete = $this->calDav->getSubscriptionsForUser($userPrincipalUri); + $this->addressBooksToDelete = $this->cardDav->getUsersOwnAddressBooks($userPrincipalUri); } public function preUnassignedUserId($uid) { @@ -130,6 +135,12 @@ class HookManager { foreach ($this->calendarsToDelete as $calendar) { $this->calDav->deleteCalendar($calendar['id']); } + + foreach ($this->subscriptionsToDelete as $subscription) { + $this->calDav->deleteSubscription( + $subscription['id'], + ); + } $this->calDav->deleteAllSharesByUser('principals/users/' . $uid); foreach ($this->addressBooksToDelete as $addressBook) { |