summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2016-08-23 15:43:54 +0200
committerLukas Reschke <lukas@statuscode.ch>2016-09-27 18:29:53 +0200
commit7db01ff8055c660dfaa2ab9d88865245dcac9e62 (patch)
tree91265b5b5022efa084fd613e28645f7f09f59950 /apps
parent6ca8ce62288aa5b181f97c45ad62c35976dbb65f (diff)
downloadnextcloud-server-7db01ff8055c660dfaa2ab9d88865245dcac9e62.tar.gz
nextcloud-server-7db01ff8055c660dfaa2ab9d88865245dcac9e62.zip
delete calendars when users are deleted
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/HookManager.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/apps/dav/lib/HookManager.php b/apps/dav/lib/HookManager.php
index 5a3e328f707..9a14c322d01 100644
--- a/apps/dav/lib/HookManager.php
+++ b/apps/dav/lib/HookManager.php
@@ -40,6 +40,9 @@ class HookManager {
/** @var IUser[] */
private $usersToDelete;
+ /** @var array */
+ private $calendarsToDelete;
+
/** @var CalDavBackend */
private $calDav;
@@ -85,7 +88,11 @@ class HookManager {
}
public function preDeleteUser($params) {
- $this->usersToDelete[$params['uid']] = $this->userManager->get($params['uid']);
+ $user = $this->userManager->get($params['uid']);
+
+ $this->usersToDelete[$params['uid']] = $user;
+
+ $this->calendarsToDelete = $this->calDav->getCalendarsForUser('principals/users/' . $user->getUID());
}
public function postDeleteUser($params) {
@@ -93,6 +100,11 @@ class HookManager {
if (isset($this->usersToDelete[$uid])){
$this->syncService->deleteUser($this->usersToDelete[$uid]);
}
+ if (!is_null($this->calendarsToDelete)) {
+ foreach ($this->calendarsToDelete as $calendar) {
+ $this->calDav->deleteCalendar($calendar['id']);
+ }
+ }
}
public function changeUser($params) {