aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/HookManager.php
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-09-22 11:24:33 +0200
committerLukas Reschke <lukas@statuscode.ch>2016-09-27 18:30:10 +0200
commit97a47f49a14a9dd2b0edb12ac54649cf9f66584a (patch)
treee37ce9c68b773828cebfd6da8ff520382672c602 /apps/dav/lib/HookManager.php
parent18c07f06929679cccf0b1dabe55bb549bae32ddd (diff)
downloadnextcloud-server-97a47f49a14a9dd2b0edb12ac54649cf9f66584a.tar.gz
nextcloud-server-97a47f49a14a9dd2b0edb12ac54649cf9f66584a.zip
Adjust delete logic and ann unit tests
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'apps/dav/lib/HookManager.php')
-rw-r--r--apps/dav/lib/HookManager.php29
1 files changed, 9 insertions, 20 deletions
diff --git a/apps/dav/lib/HookManager.php b/apps/dav/lib/HookManager.php
index f82e642c00d..03728eaf59f 100644
--- a/apps/dav/lib/HookManager.php
+++ b/apps/dav/lib/HookManager.php
@@ -40,12 +40,6 @@ class HookManager {
/** @var IUser[] */
private $usersToDelete;
- /** @var array */
- private $calendarsToDelete;
-
- /** @var array */
- private $addressBooksToDelete;
-
/** @var CalDavBackend */
private $calDav;
@@ -91,12 +85,7 @@ class HookManager {
}
public function preDeleteUser($params) {
- $user = $this->userManager->get($params['uid']);
-
- $this->usersToDelete[$params['uid']] = $user;
-
- $this->calendarsToDelete = $this->calDav->getCalendarsForUser('principals/users/' . $user->getUID());
- $this->addressBooksToDelete = $this->cardDav->getAddressBooksForUser('principals/users/' . $user->getUID());
+ $this->usersToDelete[$params['uid']] = $this->userManager->get($params['uid']);
}
public function postDeleteUser($params) {
@@ -104,15 +93,15 @@ 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']);
- }
+
+ $calendarsToDelete = $this->calDav->getCalendarsForUser('principals/users/' . $uid);
+ foreach ($calendarsToDelete as $calendar) {
+ $this->calDav->deleteCalendar($calendar['id']);
}
- if (!is_null($this->addressBooksToDelete)) {
- foreach ($this->addressBooksToDelete as $addressBook) {
- $this->cardDav->deleteAddressBook($addressBook['id']);
- }
+
+ $addressBooksToDelete = $this->cardDav->getAddressBooksForUser('principals/users/' . $uid);
+ foreach ($addressBooksToDelete as $addressBook) {
+ $this->cardDav->deleteAddressBook($addressBook['id']);
}
}