diff options
Diffstat (limited to 'core/Command/User/Enable.php')
-rw-r--r-- | core/Command/User/Enable.php | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/core/Command/User/Enable.php b/core/Command/User/Enable.php index 80efec3bc3f..eb548a74d7e 100644 --- a/core/Command/User/Enable.php +++ b/core/Command/User/Enable.php @@ -23,13 +23,15 @@ */ namespace OC\Core\Command\User; +use OC\Core\Command\Base; +use OCP\IUser; use OCP\IUserManager; -use Symfony\Component\Console\Command\Command; +use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -class Enable extends Command { +class Enable extends Base { /** @var IUserManager */ protected $userManager; @@ -63,4 +65,22 @@ class Enable extends Command { $output->writeln('<info>The specified user is enabled</info>'); return 0; } + + /** + * @param string $argumentName + * @param CompletionContext $context + * @return string[] + */ + public function completeArgumentValues($argumentName, CompletionContext $context) { + if ($argumentName === 'uid') { + return array_map( + static fn (IUser $user) => $user->getUID(), + array_filter( + $this->userManager->search($context->getCurrentWord()), + static fn (IUser $user) => !$user->isEnabled() + ) + ); + } + return []; + } } |