Browse Source

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>
pull/44753/head
Côme Chilliet 1 month ago
parent
commit
5385a30970
No account linked to committer's email address
1 changed files with 10 additions and 1 deletions
  1. 10
    1
      core/Command/User/ListCommand.php

+ 10
- 1
core/Command/User/ListCommand.php 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;

Loading…
Cancel
Save