Skip to content

Commit 121e074

Browse files
committed
fixup! Fix some tests
1 parent 1909145 commit 121e074

File tree

6 files changed

+13
-10
lines changed

6 files changed

+13
-10
lines changed

apps/user_ldap/lib/GroupPluginManager.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public function countUsersInGroup(string $gid, string $search = ''): int {
165165
if ($plugin) {
166166
$count = $plugin->countUsersInGroup($gid,$search);
167167
if ($count === false) {
168-
return -1;
168+
return 0; // no entry found
169169
}
170170
return $count;
171171
}

apps/user_ldap/lib/Group_LDAP.php

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP,
7878
protected $ldapGroupMemberAssocAttr;
7979

8080
public function __construct(Access $access, GroupPluginManager $groupPluginManager) {
81+
parent::__construct();
8182
$this->access = $access;
8283
$filter = $this->access->connection->ldapGroupFilter;
8384
$gAssoc = $this->access->connection->ldapGroupMemberAssocAttr;

apps/user_ldap/lib/Group_Proxy.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,7 @@ public function searchInGroup(string $gid, string $search = '', int $limit = -1,
312312

313313
foreach ($this->backends as $backend) {
314314
$backendUsers = $backend->searchInGroup($gid, $search, $limit, $offset);
315-
if (is_array($backendUsers)) {
316-
$users = array_merge($users, $backendUsers);
317-
}
315+
$users = array_merge($users, $backendUsers);
318316
}
319317

320318
return $users;

lib/private/Group/Database.php

+1-6
Original file line numberDiff line numberDiff line change
@@ -426,12 +426,7 @@ public function searchInGroup(string $gid, string $search = '', int $limit = -1,
426426
$userManager = \OC::$server->get(IUserManager::class);
427427
$displayNameCache = \OC::$server->get(DisplayNameCache::class);
428428
while ($row = $result->fetch()) {
429-
if (isset($row['displayname'])) {
430-
$users[$row['uid']] = new LazyUser($row['uid'], $displayNameCache, $userManager, $row['displayname']);
431-
} else {
432-
// TODO maybe also fetch the displayname directly here
433-
$users[$row['uid']] = new LazyUser($row['uid'], $displayNameCache, $userManager);
434-
}
429+
$users[$row['uid']] = new LazyUser($row['uid'], $displayNameCache, $userManager, $row['displayname'] ?? null);
435430
}
436431
$result->closeCursor();
437432

lib/private/Group/Group.php

+1
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ public function removeUser(IUser $user): void {
235235

236236
/**
237237
* Search for users in the group by userid or display name
238+
* @return IUser[]
238239
*/
239240
public function searchUsers(string $search, ?int $limit = null, ?int $offset = null): array {
240241
$users = [];

lib/public/Group/Backend/IGroupDetailsBackend.php

+8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl>
77
*
88
* @author Roeland Jago Douma <roeland@famdouma.nl>
9+
* @author Carl Schwan <carl@carlschwan.eu>
910
*
1011
* @license GNU AGPL version 3 or any later version
1112
*
@@ -26,11 +27,18 @@
2627
namespace OCP\Group\Backend;
2728

2829
/**
30+
* @brief Optional interface for group backends
2931
* @since 14.0.0
3032
*/
3133
interface IGroupDetailsBackend {
3234

3335
/**
36+
* @brief Get additional details for a group, for example the display name.
37+
*
38+
* The array returned can be empty when no additional information is available
39+
* for the group.
40+
*
41+
* @return array{displayName?: string}
3442
* @since 14.0.0
3543
*/
3644
public function getGroupDetails(string $gid): array;

0 commit comments

Comments
 (0)