Skip to content
Prev Previous commit
Add method to list disabled users to IProvideEnabledStateBackend
Signed-off-by: Côme Chilliet <[email protected]>
  • Loading branch information
come-nc committed Jun 29, 2023
commit 189ccc2d722bdfb16a96432f709d18438c80c29e
4 changes: 4 additions & 0 deletions apps/user_ldap/lib/User_LDAP.php
Original file line number Diff line number Diff line change
Expand Up @@ -681,4 +681,8 @@ public function setUserEnabled(string $uid, bool $enabled, callable $queryDataba
$setDatabaseValue($enabled);
return $enabled;
}

public function getDisabledUserList(int $offset = 0, ?int $limit = null): array {
throw new \Exception('This is implemented directly in User_Proxy');
}
}
12 changes: 12 additions & 0 deletions apps/user_ldap/lib/User_Proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
namespace OCA\User_LDAP;

use OCA\User_LDAP\User\DeletedUsersIndex;
use OCA\User_LDAP\User\OfflineUser;
use OCA\User_LDAP\User\User;
use OCP\IConfig;
use OCP\IUserBackend;
Expand Down Expand Up @@ -461,4 +462,15 @@ public function isUserEnabled(string $uid, callable $queryDatabaseValue): bool {
public function setUserEnabled(string $uid, bool $enabled, callable $queryDatabaseValue, callable $setDatabaseValue): bool {
return $this->handleRequest($uid, 'setUserEnabled', [$uid, $enabled, $queryDatabaseValue, $setDatabaseValue]);
}

public function getDisabledUserList(int $offset = 0, ?int $limit = null): array {
return array_map(
fn (OfflineUser $user) => $user->getOCName(),
array_slice(
$this->deletedUsersIndex->getUsers(),
$offset,
$limit
)
);
}
}
9 changes: 9 additions & 0 deletions lib/public/User/Backend/IProvideEnabledStateBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,13 @@ public function isUserEnabled(string $uid, callable $queryDatabaseValue): bool;
* @param callable(bool):void $setDatabaseValue A callable to set the enabled state in the database.
*/
public function setUserEnabled(string $uid, bool $enabled, callable $queryDatabaseValue, callable $setDatabaseValue): bool;

/**
* Get the list of disabled users, to merge with the ones disabled in database
*
* @since 28.0.0
*
* @return string[]
*/
public function getDisabledUserList(int $offset = 0, ?int $limit = null): array;
}