delete shares to an user
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
parent
97a47f49a1
commit
5215833fe4
|
@ -507,6 +507,16 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
$this->sharingBackend->deleteAllShares($calendarId);
|
$this->sharingBackend->deleteAllShares($calendarId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
* Returns all calendar objects within a calendar.
|
||||||
*
|
*
|
||||||
|
|
|
@ -110,6 +110,14 @@ class Backend {
|
||||||
->execute();
|
->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 IShareable $shareable
|
||||||
* @param string $element
|
* @param string $element
|
||||||
|
|
|
@ -98,6 +98,7 @@ class HookManager {
|
||||||
foreach ($calendarsToDelete as $calendar) {
|
foreach ($calendarsToDelete as $calendar) {
|
||||||
$this->calDav->deleteCalendar($calendar['id']);
|
$this->calDav->deleteCalendar($calendar['id']);
|
||||||
}
|
}
|
||||||
|
$this->calDav->deleteAllSharesForUser('principals/users/' . $uid);
|
||||||
|
|
||||||
$addressBooksToDelete = $this->cardDav->getAddressBooksForUser('principals/users/' . $uid);
|
$addressBooksToDelete = $this->cardDav->getAddressBooksForUser('principals/users/' . $uid);
|
||||||
foreach ($addressBooksToDelete as $addressBook) {
|
foreach ($addressBooksToDelete as $addressBook) {
|
||||||
|
|
|
@ -172,6 +172,7 @@ class HookManagerTest extends TestCase {
|
||||||
['id' => 'personal']
|
['id' => 'personal']
|
||||||
]);
|
]);
|
||||||
$cal->expects($this->once())->method('deleteCalendar');
|
$cal->expects($this->once())->method('deleteCalendar');
|
||||||
|
$cal->expects($this->once())->method('deleteAllSharesForUser');
|
||||||
|
|
||||||
/** @var CardDavBackend | \PHPUnit_Framework_MockObject_MockObject $card */
|
/** @var CardDavBackend | \PHPUnit_Framework_MockObject_MockObject $card */
|
||||||
$card = $this->getMockBuilder(CardDavBackend::class)
|
$card = $this->getMockBuilder(CardDavBackend::class)
|
||||||
|
|
Loading…
Reference in New Issue