feat(occ): Add --disabled option to occ user:list

Allows to easily list disabled users from cli in a efficient way

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Côme Chilliet 2024-04-09 15:47:40 +02:00
parent e0fcf6b700
commit 5385a30970
No known key found for this signature in database
GPG key ID: A3E2F658B28C760A

View file

@ -45,6 +45,11 @@ class ListCommand extends Base {
->setName('user:list')
->setDescription('list configured users')
->addOption(
'disabled',
'd',
InputOption::VALUE_NONE,
'List disabled users only'
)->addOption(
'limit',
'l',
InputOption::VALUE_OPTIONAL,
@ -71,7 +76,11 @@ class ListCommand extends Base {
}
protected function execute(InputInterface $input, OutputInterface $output): int {
$users = $this->userManager->searchDisplayName('', (int) $input->getOption('limit'), (int) $input->getOption('offset'));
if ($input->getOption('disabled')) {
$users = $this->userManager->getDisabledUsers((int) $input->getOption('limit'), (int) $input->getOption('offset'));
} else {
$users = $this->userManager->searchDisplayName('', (int) $input->getOption('limit'), (int) $input->getOption('offset'));
}
$this->writeArrayInOutputFormat($input, $output, $this->formatUsers($users, (bool)$input->getOption('info')));
return 0;