Skip to content

Commit d98410e

Browse files
committed
perf(ldap): Optimize check if LDAP user is deleted
Check first if the current user is deleted, before loading all the deleted users and checking if their deletion is still up-to-date. Allow to abort early for non-deleted users. Signed-off-by: Carl Schwan <carlschwan@kde.org>
1 parent 81a3f5c commit d98410e

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

lib/Service/LdapService.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ public function isLdapDeletedUser(IUser $user): bool {
4848
return false;
4949
}
5050

51+
if (!$dui->isUserMarked($user->getUID())) {
52+
return false;
53+
}
54+
5155
if (!$dui->hasUsers()) {
5256
return false;
5357
}

tests/stubs/oca_user_ldap.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public function hasUsers(): bool {
2626
public function getUsers(): array {
2727
return [];
2828
}
29+
30+
public function isUserMarked(string $uid): bool {}
2931
}
3032

3133
namespace OCA\User_LDAP;

0 commit comments

Comments
 (0)