fix(dav): clean up user's addressbook shares on deletion

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
pull/54424/head
Christoph Wurst 2025-08-14 15:28:13 +07:00
parent be89b726b5
commit 8e1a070bd5
No known key found for this signature in database
GPG Key ID: CC42AC2A7F0E56D8
3 changed files with 10 additions and 1 deletions

@ -1091,6 +1091,13 @@ class CardDavBackend implements BackendInterface, SyncSupport {
}, $this->db);
}
/**
* Delete all of a user's shares
*/
public function deleteAllSharesByUser(string $principaluri): void {
$this->sharingBackend->deleteAllSharesByUser($principaluri);
}
/**
* Search contacts in a specific address-book
*

@ -122,6 +122,7 @@ class UserEventsListener implements IEventListener {
);
}
$this->calDav->deleteAllSharesByUser('principals/users/' . $uid);
$this->cardDav->deleteAllSharesByUser('principals/users/' . $uid);
foreach ($this->addressBooksToDelete[$uid] as $addressBook) {
$this->cardDav->deleteAddressBook($addressBook['id']);

@ -132,7 +132,7 @@ class UserEventsListenerTest extends TestCase {
$this->userEventsListener->firstLogin($user);
}
public function testDeleteCalendar(): void {
public function testDeleteUser(): void {
$user = $this->createMock(IUser::class);
$user->expects($this->once())->method('getUID')->willReturn('newUser');
@ -148,6 +148,7 @@ class UserEventsListenerTest extends TestCase {
$this->calDavBackend->expects($this->once())->method('deleteCalendar')->with('personal');
$this->calDavBackend->expects($this->once())->method('deleteSubscription')->with('some-subscription');
$this->calDavBackend->expects($this->once())->method('deleteAllSharesByUser');
$this->cardDavBackend->expects($this->once())->method('deleteAllSharesByUser');
$this->cardDavBackend->expects($this->once())->method('getUsersOwnAddressBooks')->willReturn([
['id' => 'personal']