X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FCommand%2FListUserCommand.php;fp=src%2FWallabag%2FCoreBundle%2FCommand%2FListUserCommand.php;h=852e93b772ae6255ad6652d9da4a6b9040feb1d6;hb=af31cfed769538fcb7d283cb1fad80ac8d07b663;hp=0000000000000000000000000000000000000000;hpb=882da5c5eb283cbc7a869182b26a69b8fbebda2b;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Command/ListUserCommand.php b/src/Wallabag/CoreBundle/Command/ListUserCommand.php new file mode 100644 index 00000000..852e93b7 --- /dev/null +++ b/src/Wallabag/CoreBundle/Command/ListUserCommand.php @@ -0,0 +1,43 @@ +setName('wallabag:user:list') + ->setDescription('List all users') + ->setHelp('This command list all existing users') + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new SymfonyStyle($input, $output); + + $users = $this->getContainer()->get('wallabag_user.user_repository')->findAll(); + + $rows = []; + foreach ($users as $user) { + $rows[] = [ + $user->getUsername(), + $user->getEmail(), + $user->isEnabled() ? 'yes' : 'no', + $user->hasRole('ROLE_SUPER_ADMIN') || $user->hasRole('ROLE_ADMIN') ? 'yes' : 'no', + ]; + } + + $io->table(['username', 'email', 'is enabled?', 'is admin?'], $rows); + + $io->success(sprintf('%s user(s) displayed.', count($users))); + + return 0; + } +}