Merge pull request #44753 from nextcloud/feat/add-disabled-option-for-user-list

feat(occ): Add --disabled option to occ user:list
This commit is contained in:
Pytal 2024-04-09 10:04:04 -07:00 committed by GitHub
commit beb839b1f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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;