From f5ab0335f9118786bac466b54aa99f8e3ccf2ff4 Mon Sep 17 00:00:00 2001 From: matthieu Date: Fri, 3 Apr 2026 13:19:24 +0200 Subject: [PATCH] =?UTF-8?q?Revert=20"feat=20:=20commande=20app:create-user?= =?UTF-8?q?=20pour=20cr=C3=A9er=20des=20utilisateurs"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit ad92a4c434e84f0280371a9ef983a7ca4ec46b66. --- src/Command/CreateUserCommand.php | 66 ------------------------------- 1 file changed, 66 deletions(-) delete mode 100644 src/Command/CreateUserCommand.php diff --git a/src/Command/CreateUserCommand.php b/src/Command/CreateUserCommand.php deleted file mode 100644 index 7931d1d..0000000 --- a/src/Command/CreateUserCommand.php +++ /dev/null @@ -1,66 +0,0 @@ -addArgument('username', InputArgument::REQUIRED, 'Username') - ->addArgument('password', InputArgument::REQUIRED, 'Plain text password') - ->addOption('admin', 'a', InputOption::VALUE_NONE, 'Grant ROLE_ADMIN'); - } - - protected function execute(InputInterface $input, OutputInterface $output): int - { - $io = new SymfonyStyle($input, $output); - - $username = $input->getArgument('username'); - $plainPassword = $input->getArgument('password'); - - $existing = $this->em->getRepository(User::class)->findOneBy(['username' => $username]); - - if ($existing) { - $io->error(sprintf('User "%s" already exists.', $username)); - - return Command::FAILURE; - } - - $user = new User(); - $user->setUsername($username); - $user->setPassword($this->passwordHasher->hashPassword($user, $plainPassword)); - $user->setRoles($input->getOption('admin') ? ['ROLE_ADMIN'] : []); - - $this->em->persist($user); - $this->em->flush(); - - $io->success(sprintf('User "%s" created%s.', $username, $input->getOption('admin') ? ' (admin)' : '')); - - return Command::SUCCESS; - } -}