Remove users from system addressbook when user deactivated
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
ca54166e35
commit
a311798674
|
@ -270,18 +270,22 @@ class SyncService {
|
|||
|
||||
$cardId = "$name:$userId.vcf";
|
||||
$card = $this->backend->getCard($addressBookId, $cardId);
|
||||
if ($card === false) {
|
||||
$vCard = $converter->createCardFromUser($user);
|
||||
if ($vCard !== null) {
|
||||
$this->backend->createCard($addressBookId, $cardId, $vCard->serialize());
|
||||
if ($user->isEnabled()) {
|
||||
if ($card === false) {
|
||||
$vCard = $converter->createCardFromUser($user);
|
||||
if ($vCard !== null) {
|
||||
$this->backend->createCard($addressBookId, $cardId, $vCard->serialize());
|
||||
}
|
||||
} else {
|
||||
$vCard = $converter->createCardFromUser($user);
|
||||
if (is_null($vCard)) {
|
||||
$this->backend->deleteCard($addressBookId, $cardId);
|
||||
} else {
|
||||
$this->backend->updateCard($addressBookId, $cardId, $vCard->serialize());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$vCard = $converter->createCardFromUser($user);
|
||||
if (is_null($vCard)) {
|
||||
$this->backend->deleteCard($addressBookId, $cardId);
|
||||
} else {
|
||||
$this->backend->updateCard($addressBookId, $cardId, $vCard->serialize());
|
||||
}
|
||||
$this->backend->deleteCard($addressBookId, $cardId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -106,6 +106,7 @@ class SyncServiceTest extends TestCase {
|
|||
$user->method('getUID')->willReturn('test-user');
|
||||
$user->method('getCloudId')->willReturn('cloudId');
|
||||
$user->method('getDisplayName')->willReturn('test-user');
|
||||
$user->method('isEnabled')->willReturn(true);
|
||||
$accountManager = $this->getMockBuilder(AccountManager::class)->disableOriginalConstructor()->getMock();
|
||||
$accountManager->expects($this->any())->method('getUser')
|
||||
->willReturn([
|
||||
|
|
Loading…
Reference in New Issue