delete also addressbooks on user deletion
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
parent
7db01ff805
commit
18c07f0692
|
@ -43,6 +43,9 @@ class HookManager {
|
||||||
/** @var array */
|
/** @var array */
|
||||||
private $calendarsToDelete;
|
private $calendarsToDelete;
|
||||||
|
|
||||||
|
/** @var array */
|
||||||
|
private $addressBooksToDelete;
|
||||||
|
|
||||||
/** @var CalDavBackend */
|
/** @var CalDavBackend */
|
||||||
private $calDav;
|
private $calDav;
|
||||||
|
|
||||||
|
@ -93,6 +96,7 @@ class HookManager {
|
||||||
$this->usersToDelete[$params['uid']] = $user;
|
$this->usersToDelete[$params['uid']] = $user;
|
||||||
|
|
||||||
$this->calendarsToDelete = $this->calDav->getCalendarsForUser('principals/users/' . $user->getUID());
|
$this->calendarsToDelete = $this->calDav->getCalendarsForUser('principals/users/' . $user->getUID());
|
||||||
|
$this->addressBooksToDelete = $this->cardDav->getAddressBooksForUser('principals/users/' . $user->getUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postDeleteUser($params) {
|
public function postDeleteUser($params) {
|
||||||
|
@ -105,6 +109,11 @@ class HookManager {
|
||||||
$this->calDav->deleteCalendar($calendar['id']);
|
$this->calDav->deleteCalendar($calendar['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!is_null($this->addressBooksToDelete)) {
|
||||||
|
foreach ($this->addressBooksToDelete as $addressBook) {
|
||||||
|
$this->cardDav->deleteAddressBook($addressBook['id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function changeUser($params) {
|
public function changeUser($params) {
|
||||||
|
|
Loading…
Reference in New Issue