aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/User_Proxy.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/user_ldap/lib/User_Proxy.php')
-rw-r--r--apps/user_ldap/lib/User_Proxy.php50
1 files changed, 17 insertions, 33 deletions
diff --git a/apps/user_ldap/lib/User_Proxy.php b/apps/user_ldap/lib/User_Proxy.php
index 5079830b83c..0d41f495ce9 100644
--- a/apps/user_ldap/lib/User_Proxy.php
+++ b/apps/user_ldap/lib/User_Proxy.php
@@ -18,13 +18,10 @@ use OCP\User\Backend\IProvideEnabledStateBackend;
use OCP\UserInterface;
use Psr\Log\LoggerInterface;
+/**
+ * @template-extends Proxy<User_LDAP>
+ */
class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP, ILimitAwareCountUsersBackend, ICountMappedUsersBackend, IProvideEnabledStateBackend {
- /** @var User_LDAP[] */
- private array $backends = [];
- private ?User_LDAP $refBackend = null;
-
- private bool $isSetUp = false;
-
public function __construct(
private Helper $helper,
ILDAPWrapper $ldap,
@@ -34,30 +31,17 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP
private LoggerInterface $logger,
private DeletedUsersIndex $deletedUsersIndex,
) {
- parent::__construct($ldap, $accessFactory);
+ parent::__construct($helper, $ldap, $accessFactory);
}
- protected function setup(): void {
- if ($this->isSetUp) {
- return;
- }
-
- $serverConfigPrefixes = $this->helper->getServerConfigurationPrefixes(true);
- foreach ($serverConfigPrefixes as $configPrefix) {
- $this->backends[$configPrefix] = new User_LDAP(
- $this->getAccess($configPrefix),
- $this->notificationManager,
- $this->userPluginManager,
- $this->logger,
- $this->deletedUsersIndex,
- );
-
- if (is_null($this->refBackend)) {
- $this->refBackend = $this->backends[$configPrefix];
- }
- }
-
- $this->isSetUp = true;
+ protected function newInstance(string $configPrefix): User_LDAP {
+ return new User_LDAP(
+ $this->getAccess($configPrefix),
+ $this->notificationManager,
+ $this->userPluginManager,
+ $this->logger,
+ $this->deletedUsersIndex,
+ );
}
/**
@@ -431,11 +415,11 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP
if ($search !== '') {
$disabledUsers = array_filter(
$disabledUsers,
- fn (OfflineUser $user): bool =>
- mb_stripos($user->getOCName(), $search) !== false ||
- mb_stripos($user->getUID(), $search) !== false ||
- mb_stripos($user->getDisplayName(), $search) !== false ||
- mb_stripos($user->getEmail(), $search) !== false,
+ fn (OfflineUser $user): bool
+ => mb_stripos($user->getOCName(), $search) !== false
+ || mb_stripos($user->getUID(), $search) !== false
+ || mb_stripos($user->getDisplayName(), $search) !== false
+ || mb_stripos($user->getEmail(), $search) !== false,
);
}
return array_map(