feat(userList): Allow to list all users

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
pull/57179/head
Git'Fellow 2025-12-18 13:48:47 +07:00
parent 154f3597b4
commit b585280534
1 changed files with 9 additions and 3 deletions

@ -35,7 +35,7 @@ class ListCommand extends Base {
'limit',
'l',
InputOption::VALUE_OPTIONAL,
'Number of users to retrieve',
'Number of users to retrieve (0 for unlimited)',
'500'
)->addOption(
'offset',
@ -58,10 +58,16 @@ class ListCommand extends Base {
}
protected function execute(InputInterface $input, OutputInterface $output): int {
$limit = (int)$input->getOption('limit');
$offset = (int)$input->getOption('offset');
// Allow --limit 0 to mean unlimited
$actualLimit = ($limit === 0) ? null : $limit;
if ($input->getOption('disabled')) {
$users = $this->userManager->getDisabledUsers((int)$input->getOption('limit'), (int)$input->getOption('offset'));
$users = $this->userManager->getDisabledUsers($actualLimit, $offset);
} else {
$users = $this->userManager->searchDisplayName('', (int)$input->getOption('limit'), (int)$input->getOption('offset'));
$users = $this->userManager->searchDisplayName('', $actualLimit, $offset);
}
$this->writeArrayInOutputFormat($input, $output, $this->formatUsers($users, (bool)$input->getOption('info')));