diff options
Diffstat (limited to 'apps/dav')
-rw-r--r-- | apps/dav/lib/CalDAV/CalDavBackend.php | 10 | ||||
-rw-r--r-- | apps/dav/lib/DAV/Sharing/Backend.php | 8 | ||||
-rw-r--r-- | apps/dav/lib/HookManager.php | 1 | ||||
-rw-r--r-- | apps/dav/tests/unit/DAV/HookManagerTest.php | 1 |
4 files changed, 20 insertions, 0 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 17479c490a9..367b239a67d 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -508,6 +508,16 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription } /** + * Delete all of an user's shares + * + * @param string $principaluri + * @return void + */ + function deleteAllSharesForUser($principaluri) { + $this->sharingBackend->deleteAllSharesByUser($principaluri); + } + + /** * Returns all calendar objects within a calendar. * * Every item contains an array with the following keys: diff --git a/apps/dav/lib/DAV/Sharing/Backend.php b/apps/dav/lib/DAV/Sharing/Backend.php index 006fe334ba2..f662d8e1b80 100644 --- a/apps/dav/lib/DAV/Sharing/Backend.php +++ b/apps/dav/lib/DAV/Sharing/Backend.php @@ -110,6 +110,14 @@ class Backend { ->execute(); } + public function deleteAllSharesByUser($principaluri) { + $query = $this->db->getQueryBuilder(); + $query->delete('dav_shares') + ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principaluri))) + ->andWhere($query->expr()->eq('type', $query->createNamedParameter($this->resourceType))) + ->execute(); + } + /** * @param IShareable $shareable * @param string $element diff --git a/apps/dav/lib/HookManager.php b/apps/dav/lib/HookManager.php index 03728eaf59f..1680a907755 100644 --- a/apps/dav/lib/HookManager.php +++ b/apps/dav/lib/HookManager.php @@ -98,6 +98,7 @@ class HookManager { foreach ($calendarsToDelete as $calendar) { $this->calDav->deleteCalendar($calendar['id']); } + $this->calDav->deleteAllSharesForUser('principals/users/' . $uid); $addressBooksToDelete = $this->cardDav->getAddressBooksForUser('principals/users/' . $uid); foreach ($addressBooksToDelete as $addressBook) { diff --git a/apps/dav/tests/unit/DAV/HookManagerTest.php b/apps/dav/tests/unit/DAV/HookManagerTest.php index 05384813f02..cde24214dd1 100644 --- a/apps/dav/tests/unit/DAV/HookManagerTest.php +++ b/apps/dav/tests/unit/DAV/HookManagerTest.php @@ -172,6 +172,7 @@ class HookManagerTest extends TestCase { ['id' => 'personal'] ]); $cal->expects($this->once())->method('deleteCalendar'); + $cal->expects($this->once())->method('deleteAllSharesForUser'); /** @var CardDavBackend | \PHPUnit_Framework_MockObject_MockObject $card */ $card = $this->getMockBuilder(CardDavBackend::class) |