Skip to content

Commit 82759db

Browse files
committed
Let OC\Group\Group handle the fallback and remove default implementation from ABackend
Signed-off-by: Côme Chilliet <[email protected]>
1 parent fc4212d commit 82759db

File tree

3 files changed

+3
-31
lines changed

3 files changed

+3
-31
lines changed

apps/user_ldap/lib/Group_LDAP.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,11 @@
4848
use OC\ServerNotAvailableException;
4949
use OCP\Cache\CappedMemoryCache;
5050
use OCP\GroupInterface;
51-
use OCP\Group\Backend\ABackend;
5251
use OCP\Group\Backend\IDeleteGroupBackend;
5352
use OCP\Group\Backend\IGetDisplayNameBackend;
5453
use Psr\Log\LoggerInterface;
5554

56-
class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDisplayNameBackend, IDeleteGroupBackend {
55+
class Group_LDAP extends BackendUtility implements GroupInterface, IGroupLDAP, IGetDisplayNameBackend, IDeleteGroupBackend {
5756
protected bool $enabled = false;
5857

5958
/** @var CappedMemoryCache<string[]> $cachedGroupMembers array of users with gid as key */
@@ -64,15 +63,14 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis
6463
protected CappedMemoryCache $cachedNestedGroups;
6564
protected GroupPluginManager $groupPluginManager;
6665
protected LoggerInterface $logger;
67-
protected Access $access;
6866

6967
/**
7068
* @var string $ldapGroupMemberAssocAttr contains the LDAP setting (in lower case) with the same name
7169
*/
7270
protected string $ldapGroupMemberAssocAttr;
7371

7472
public function __construct(Access $access, GroupPluginManager $groupPluginManager) {
75-
$this->access = $access;
73+
parent::__construct($access);
7674
$filter = $this->access->connection->ldapGroupFilter;
7775
$gAssoc = $this->access->connection->ldapGroupMemberAssocAttr;
7876
if (!empty($filter) && !empty($gAssoc)) {
@@ -1333,11 +1331,4 @@ public function getDisplayName(string $gid): string {
13331331
$this->access->connection->writeToCache($cacheKey, $displayName);
13341332
return $displayName;
13351333
}
1336-
1337-
public function searchInGroup(string $gid, string $search = '', int $limit = -1, int $offset = 0): array {
1338-
if (!$this->enabled) {
1339-
return [];
1340-
}
1341-
return parent::searchInGroup($gid, $search, $limit, $offset);
1342-
}
13431334
}

build/psalm-baseline-ocp.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
<code>OC</code>
66
</UndefinedClass>
77
</file>
8-
<file src="lib/public/Group/Backend/ABackend.php">
9-
<UndefinedClass occurrences="2">
10-
<code>OC</code>
11-
</UndefinedClass>
12-
</file>
138
<file src="lib/public/AppFramework/ApiController.php">
149
<NoInterfaceProperties occurrences="1">
1510
<code>$this-&gt;request-&gt;server</code>

lib/public/Group/Backend/ABackend.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,11 @@
2626
namespace OCP\Group\Backend;
2727

2828
use OCP\GroupInterface;
29-
use OCP\IUserManager;
30-
use OCP\Server;
31-
use OC\User\LazyUser;
3229

3330
/**
3431
* @since 14.0.0
3532
*/
36-
abstract class ABackend implements GroupInterface, ISearchableGroupBackend {
37-
33+
abstract class ABackend implements GroupInterface {
3834
/**
3935
* @deprecated 14.0.0
4036
*
@@ -68,14 +64,4 @@ public function implementsActions($actions): bool {
6864

6965
return (bool)($actions & $implements);
7066
}
71-
72-
public function searchInGroup(string $gid, string $search = '', int $limit = -1, int $offset = 0): array {
73-
// Default implementation for compatibility reasons
74-
$userManager = Server::get(IUserManager::class);
75-
$users = [];
76-
foreach ($this->usersInGroup($gid, $search, $limit, $offset) as $userId) {
77-
$users[$userId] = new LazyUser($userId, $userManager);
78-
}
79-
return $users;
80-
}
8167
}

0 commit comments

Comments
 (0)