diff options
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 3929fdabbd0..02c7291c689 100644 --- a/apps/dav/lib/HookManager.php +++ b/apps/dav/lib/HookManager.php @@ -57,6 +57,9 @@ class HookManager { private $calendarsToDelete = []; /** @var array */ + private $subscriptionsToDelete = []; + + /** @var array */ private $addressBooksToDelete = []; /** @var EventDispatcherInterface */ @@ -110,9 +113,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) { @@ -131,6 +136,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) { |