3 namespace Wallabag\CoreBundle\Command
;
5 use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand
;
6 use Symfony\Component\Console\Input\InputInterface
;
7 use Symfony\Component\Console\Output\OutputInterface
;
8 use Symfony\Component\Console\Style\SymfonyStyle
;
10 class ListUserCommand
extends ContainerAwareCommand
12 protected function configure()
15 ->setName('wallabag:user:list')
16 ->setDescription('List all users')
17 ->setHelp('This command list all existing users')
21 protected function execute(InputInterface
$input, OutputInterface
$output)
23 $io = new SymfonyStyle($input, $output);
25 $users = $this->getContainer()->get('wallabag_user.user_repository')->findAll();
28 foreach ($users as $user) {
32 $user->isEnabled() ? 'yes' : 'no',
33 $user->hasRole('ROLE_SUPER_ADMIN') || $user->hasRole('ROLE_ADMIN') ? 'yes' : 'no',
37 $io->table(['username', 'email', 'is enabled?', 'is admin?'], $rows);
39 $io->success(sprintf('%s user(s) displayed.', count($users)));