delete calendars when users are deleted

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
pull/1545/head
Thomas Citharel 10 years ago committed by Lukas Reschke
parent 6ca8ce6228
commit 7db01ff805
No known key found for this signature in database
GPG Key ID: B9F6980CF6E759B1
  1. 14
      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) {

Loading…
Cancel
Save