From 5385a30970f3e168982be5554dbe618df363574c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Tue, 9 Apr 2024 15:47:40 +0200 Subject: [PATCH] feat(occ): Add --disabled option to occ user:list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allows to easily list disabled users from cli in a efficient way Signed-off-by: Côme Chilliet --- core/Command/User/ListCommand.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/Command/User/ListCommand.php b/core/Command/User/ListCommand.php index f25d6c2dae9d7..c30d2a5539571 100644 --- a/core/Command/User/ListCommand.php +++ b/core/Command/User/ListCommand.php @@ -45,6 +45,11 @@ protected function configure() { ->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 @@ protected function configure() { } 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;