delete also addressbooks on user deletion

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
Thomas Citharel 2016-08-23 16:20:41 +02:00 committed by Lukas Reschke
parent 7db01ff805
commit 18c07f0692
No known key found for this signature in database
GPG Key ID: B9F6980CF6E759B1
1 changed files with 9 additions and 0 deletions

View File

@ -43,6 +43,9 @@ class HookManager {
/** @var array */
private $calendarsToDelete;
/** @var array */
private $addressBooksToDelete;
/** @var CalDavBackend */
private $calDav;
@ -93,6 +96,7 @@ class HookManager {
$this->usersToDelete[$params['uid']] = $user;
$this->calendarsToDelete = $this->calDav->getCalendarsForUser('principals/users/' . $user->getUID());
$this->addressBooksToDelete = $this->cardDav->getAddressBooksForUser('principals/users/' . $user->getUID());
}
public function postDeleteUser($params) {
@ -105,6 +109,11 @@ class HookManager {
$this->calDav->deleteCalendar($calendar['id']);
}
}
if (!is_null($this->addressBooksToDelete)) {
foreach ($this->addressBooksToDelete as $addressBook) {
$this->cardDav->deleteAddressBook($addressBook['id']);
}
}
}
public function changeUser($params) {