Skip to content

Commit 01190a9

Browse files
committed
fixup! fixup! Fix some tests
1 parent 5eae494 commit 01190a9

File tree

4 files changed

+4
-16
lines changed

4 files changed

+4
-16
lines changed

apps/user_ldap/lib/GroupPluginManager.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,7 @@ public function countUsersInGroup(string $gid, string $search = ''): int {
163163
$plugin = $this->which[GroupInterface::COUNT_USERS];
164164

165165
if ($plugin) {
166-
$count = $plugin->countUsersInGroup($gid,$search);
167-
if ($count === false) {
168-
return 0; // no entry found
169-
}
170-
return $count;
166+
return (int)$plugin->countUsersInGroup($gid, $search);
171167
}
172168
throw new \Exception('No plugin implements countUsersInGroup in this LDAP Backend.');
173169
}

apps/user_ldap/lib/Group_LDAP.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1028,15 +1028,15 @@ public function countUsersInGroup(string $gid, string $search = ''): int {
10281028
$groupDN = $this->access->groupname2dn($gid);
10291029
if (!$groupDN) {
10301030
// group couldn't be found, return empty result set
1031-
$this->access->connection->writeToCache($cacheKey, false);
1031+
$this->access->connection->writeToCache($cacheKey, 0);
10321032
return 0;
10331033
}
10341034

10351035
$members = $this->_groupMembers($groupDN);
10361036
$primaryUserCount = $this->countUsersInPrimaryGroup($groupDN, '');
10371037
if (!$members && $primaryUserCount === 0) {
10381038
//in case users could not be retrieved, return empty result set
1039-
$this->access->connection->writeToCache($cacheKey, false);
1039+
$this->access->connection->writeToCache($cacheKey, 0);
10401040
return 0;
10411041
}
10421042

apps/user_ldap/lib/Group_Proxy.php

+1-8
Original file line numberDiff line numberDiff line change
@@ -311,13 +311,6 @@ public function getBackendName(): string {
311311
}
312312

313313
public function searchInGroup(string $gid, string $search = '', int $limit = -1, int $offset = 0): array {
314-
$users = [];
315-
316-
foreach ($this->backends as $backend) {
317-
$backendUsers = $backend->searchInGroup($gid, $search, $limit, $offset);
318-
$users = array_merge($users, $backendUsers);
319-
}
320-
321-
return $users;
314+
return $this->handleRequest($gid, 'searchInGroup', [$gid, $search, $limit, $offset]);
322315
}
323316
}

tests/lib/Util/Group/Dummy.php

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
use OCP\Group\Backend\IRemoveFromGroupBackend;
3636
use OCP\Group\Backend\ICreateGroupBackend;
3737
use OCP\Group\Backend\ICountUsersBackend;
38-
use OCP\IUser;
3938

4039
/**
4140
* Dummy group backend, does not keep state, only for testing use

0 commit comments

Comments
 (0)