aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/User
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2024-05-16 16:13:31 +0200
committerCôme Chilliet <come.chilliet@nextcloud.com>2024-05-27 15:03:03 +0200
commit896c539705be3c420fd983e36a84ffac1c84ad94 (patch)
treea9a1db5131c56bd2e4d0ae8b68d89369cdf58eb0 /lib/private/User
parent1e9a7e47792673bb6fd111ff2d75e70bef9eb5f9 (diff)
downloadnextcloud-server-896c539705be3c420fd983e36a84ffac1c84ad94.tar.gz
nextcloud-server-896c539705be3c420fd983e36a84ffac1c84ad94.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 'lib/private/User')
-rw-r--r--lib/private/User/Manager.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/private/User/Manager.php b/lib/private/User/Manager.php
index ea460739f60..a316708ddef 100644
--- a/lib/private/User/Manager.php
+++ b/lib/private/User/Manager.php
@@ -341,7 +341,7 @@ class Manager extends PublicEmitter implements IUserManager {
/**
* @return IUser[]
*/
- public function getDisabledUsers(?int $limit = null, int $offset = 0): array {
+ public function getDisabledUsers(?int $limit = null, int $offset = 0, string $search = ''): array {
$users = $this->config->getUsersForUserValue('core', 'enabled', 'false');
$users = array_combine(
$users,
@@ -350,6 +350,14 @@ class Manager extends PublicEmitter implements IUserManager {
$users
)
);
+ if ($search !== '') {
+ $users = array_filter(
+ $users,
+ fn (IUser $user): bool =>
+ mb_stripos($user->getUID(), $search) !== false ||
+ mb_stripos($user->getDisplayName(), $search) !== false,
+ );
+ }
$tempLimit = ($limit === null ? null : $limit + $offset);
foreach ($this->backends as $backend) {
@@ -357,7 +365,7 @@ class Manager extends PublicEmitter implements IUserManager {
break;
}
if ($backend instanceof IProvideEnabledStateBackend) {
- $backendUsers = $backend->getDisabledUserList(($tempLimit === null ? null : $tempLimit - count($users)));
+ $backendUsers = $backend->getDisabledUserList(($tempLimit === null ? null : $tempLimit - count($users)), 0, $search);
foreach ($backendUsers as $uid) {
$users[$uid] = new LazyUser($uid, $this, null, $backend);
}