Next major version 2 with PHP 8.1, Symfony 6, Tabler UI, 2FA ... (#2902)

This commit is contained in:
Kevin Papst
2022-12-31 21:19:55 +01:00
committed by GitHub
parent 95e06746bd
commit 90a0fd8a22
2164 changed files with 83700 additions and 86426 deletions

View File

@@ -10,47 +10,38 @@
namespace App\Command;
use App\User\UserService;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
class DeactivateUserCommand extends Command
#[AsCommand(name: 'kimai:user:deactivate')]
final class DeactivateUserCommand extends Command
{
private $userService;
public function __construct(UserService $userService)
public function __construct(private UserService $userService)
{
parent::__construct();
$this->userService = $userService;
}
/**
* {@inheritdoc}
*/
protected function configure()
protected function configure(): void
{
$this
->setName('kimai:user:deactivate')
->setAliases(['fos:user:deactivate'])
->setDescription('Deactivate a user')
->setDefinition([
new InputArgument('username', InputArgument::REQUIRED, 'The username'),
])
->setHelp(
<<<'EOT'
The <info>kimai:user:deactivate</info> command deactivates a user (will not be able to log in)
The <info>kimai:user:deactivate</info> command deactivates a user (will not be able to log in)
<info>php %command.full_name% susan_super</info>
EOT
<info>php %command.full_name% susan_super</info>
EOT
);
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$username = $input->getArgument('username');
$user = $this->userService->findUserByUsernameOrThrowException($username);
@@ -65,6 +56,6 @@ EOT
$io->warning(sprintf('User "%s" is already deactivated.', $username));
}
return 0;
return Command::SUCCESS;
}
}