diff options
author | Thomas Citharel <tcit@tcit.fr> | 2021-08-13 14:19:03 +0200 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2021-08-13 14:19:03 +0200 |
commit | 57e2f2a903cad170eb9533b7dccdf4afaa93dd2f (patch) | |
tree | f92a34c62e363e7553befc394707c3f402d6e8df /apps/dav/lib/HookManager.php | |
parent | fa56c13484afa1baf908b93ed5b6990c6a0e9ad6 (diff) | |
download | nextcloud-server-57e2f2a903cad170eb9533b7dccdf4afaa93dd2f.tar.gz nextcloud-server-57e2f2a903cad170eb9533b7dccdf4afaa93dd2f.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 03e7551e971..1287104fd10 100644 --- a/apps/dav/lib/HookManager.php +++ b/apps/dav/lib/HookManager.php @@ -58,6 +58,9 @@ class HookManager { private $calendarsToDelete = []; /** @var array */ + private $subscriptionsToDelete = []; + + /** @var array */ private $addressBooksToDelete = []; /** @var Defaults */ @@ -116,9 +119,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) { @@ -137,6 +142,12 @@ class HookManager { true // Make sure the data doesn't go into the trashbin, a new user with the same UID would later see it otherwise ); } + + foreach ($this->subscriptionsToDelete as $subscription) { + $this->calDav->deleteSubscription( + $subscription['id'], + ); + } $this->calDav->deleteAllSharesByUser('principals/users/' . $uid); foreach ($this->addressBooksToDelete as $addressBook) { |