diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-05-16 16:13:31 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-05-23 09:08:31 +0200 |
commit | 6d56f3557d3eba4f41d0381c6f8fc8fda036a3b4 (patch) | |
tree | 92a5389dd0f90945b8429104e34550540be83fd1 /apps/user_ldap/lib | |
parent | 474cbda59a4c5c4a225918724a871451a0f49a7f (diff) | |
download | nextcloud-server-6d56f3557d3eba4f41d0381c6f8fc8fda036a3b4.tar.gz nextcloud-server-6d56f3557d3eba4f41d0381c6f8fc8fda036a3b4.zip |
feat: Add back searching in disabled user list
When disabled users where moved to their own endpoint we overlooked
search, so adding it back.
The search is done case-insensitive in uid and display name.
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/user_ldap/lib')
-rw-r--r-- | apps/user_ldap/lib/User_LDAP.php | 2 | ||||
-rw-r--r-- | apps/user_ldap/lib/User_Proxy.php | 14 |
2 files changed, 13 insertions, 3 deletions
diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php index 7d5562f0ee0..6b12ef0ace3 100644 --- a/apps/user_ldap/lib/User_LDAP.php +++ b/apps/user_ldap/lib/User_LDAP.php @@ -682,7 +682,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I return $enabled; } - public function getDisabledUserList(?int $limit = null, int $offset = 0): array { + public function getDisabledUserList(?int $limit = null, int $offset = 0, string $search = ''): array { throw new \Exception('This is implemented directly in User_Proxy'); } } diff --git a/apps/user_ldap/lib/User_Proxy.php b/apps/user_ldap/lib/User_Proxy.php index 3df1990359a..5f17548fac7 100644 --- a/apps/user_ldap/lib/User_Proxy.php +++ b/apps/user_ldap/lib/User_Proxy.php @@ -463,11 +463,21 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP return $this->handleRequest($uid, 'setUserEnabled', [$uid, $enabled, $queryDatabaseValue, $setDatabaseValue]); } - public function getDisabledUserList(?int $limit = null, int $offset = 0): array { + public function getDisabledUserList(?int $limit = null, int $offset = 0, string $search = ''): array { + $disabledUsers = $this->deletedUsersIndex->getUsers(); + if ($search !== '') { + $disabledUsers = array_filter( + $disabledUsers, + fn (OfflineUser $user): bool => + mb_stripos($user->getOCName(), $search) !== false || + mb_stripos($user->getUID(), $search) !== false || + mb_stripos($user->getDisplayName(), $search) !== false, + ); + } return array_map( fn (OfflineUser $user) => $user->getOCName(), array_slice( - $this->deletedUsersIndex->getUsers(), + $disabledUsers, $offset, $limit ) |