delete calendars when users are deleted
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
parent
6ca8ce6228
commit
7db01ff805
|
@ -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…
Reference in New Issue