diff --git a/apps/user_ldap/lib/GroupPluginManager.php b/apps/user_ldap/lib/GroupPluginManager.php index e905939ab4424..524cc81ad011a 100644 --- a/apps/user_ldap/lib/GroupPluginManager.php +++ b/apps/user_ldap/lib/GroupPluginManager.php @@ -163,11 +163,7 @@ public function countUsersInGroup(string $gid, string $search = ''): int { $plugin = $this->which[GroupInterface::COUNT_USERS]; if ($plugin) { - $count = $plugin->countUsersInGroup($gid,$search); - if ($count === false) { - return 0; // no entry found - } - return $count; + return (int)$plugin->countUsersInGroup($gid, $search); } throw new \Exception('No plugin implements countUsersInGroup in this LDAP Backend.'); } diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php index 57f2c4dfbe4ce..db6c3a9855e8a 100644 --- a/apps/user_ldap/lib/Group_LDAP.php +++ b/apps/user_ldap/lib/Group_LDAP.php @@ -1028,7 +1028,7 @@ public function countUsersInGroup(string $gid, string $search = ''): int { $groupDN = $this->access->groupname2dn($gid); if (!$groupDN) { // group couldn't be found, return empty result set - $this->access->connection->writeToCache($cacheKey, false); + $this->access->connection->writeToCache($cacheKey, 0); return 0; } @@ -1036,7 +1036,7 @@ public function countUsersInGroup(string $gid, string $search = ''): int { $primaryUserCount = $this->countUsersInPrimaryGroup($groupDN, ''); if (!$members && $primaryUserCount === 0) { //in case users could not be retrieved, return empty result set - $this->access->connection->writeToCache($cacheKey, false); + $this->access->connection->writeToCache($cacheKey, 0); return 0; } diff --git a/apps/user_ldap/lib/Group_Proxy.php b/apps/user_ldap/lib/Group_Proxy.php index 09d21d5cbac8f..7a55cec373d6d 100644 --- a/apps/user_ldap/lib/Group_Proxy.php +++ b/apps/user_ldap/lib/Group_Proxy.php @@ -311,13 +311,6 @@ public function getBackendName(): string { } public function searchInGroup(string $gid, string $search = '', int $limit = -1, int $offset = 0): array { - $users = []; - - foreach ($this->backends as $backend) { - $backendUsers = $backend->searchInGroup($gid, $search, $limit, $offset); - $users = array_merge($users, $backendUsers); - } - - return $users; + return $this->handleRequest($gid, 'searchInGroup', [$gid, $search, $limit, $offset]); } } diff --git a/tests/lib/Util/Group/Dummy.php b/tests/lib/Util/Group/Dummy.php index 9882fc829ac41..99d4fc1a77505 100644 --- a/tests/lib/Util/Group/Dummy.php +++ b/tests/lib/Util/Group/Dummy.php @@ -35,7 +35,6 @@ use OCP\Group\Backend\IRemoveFromGroupBackend; use OCP\Group\Backend\ICreateGroupBackend; use OCP\Group\Backend\ICountUsersBackend; -use OCP\IUser; /** * Dummy group backend, does not keep state, only for testing use