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

@@ -11,37 +11,31 @@ namespace App\Command;
use App\Entity\User;
use App\User\UserService;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Style\SymfonyStyle;
class PromoteUserCommand extends AbstractRoleCommand
#[AsCommand(name: 'kimai:user:promote')]
final class PromoteUserCommand extends AbstractRoleCommand
{
/**
* {@inheritdoc}
*/
protected function configure()
protected function configure(): void
{
parent::configure();
$this
->setName('kimai:user:promote')
->setAliases(['fos:user:promote'])
->setDescription('Promotes a user by adding a role')
->setHelp(
<<<'EOT'
The <info>kimai:user:promote</info> command promotes a user by adding a role
The <info>kimai:user:promote</info> command promotes a user by adding a role
<info>php %command.full_name% susan_super ROLE_TEAMLEAD</info>
<info>php %command.full_name% --super susan_super</info>
EOT
<info>php %command.full_name% susan_super ROLE_TEAMLEAD</info>
<info>php %command.full_name% --super susan_super</info>
EOT
);
}
/**
* {@inheritdoc}
*/
protected function executeRoleCommand(UserService $manipulator, SymfonyStyle $output, User $user, bool $super, $role)
{
$username = $user->getUsername();
$username = $user->getUserIdentifier();
if ($super) {
if (!$user->isSuperAdmin()) {
$user->setSuperAdmin(true);