From 90c84e4a9fa52290ffa2e4b428eff7d663507aff Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Mon, 3 Mar 2025 09:14:00 +0100 Subject: [PATCH 1/2] Added userAdminCommand --- src/Command/LoadDefaultUserAdminCommand.php | 48 +++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/Command/LoadDefaultUserAdminCommand.php diff --git a/src/Command/LoadDefaultUserAdminCommand.php b/src/Command/LoadDefaultUserAdminCommand.php new file mode 100644 index 0000000..39862ac --- /dev/null +++ b/src/Command/LoadDefaultUserAdminCommand.php @@ -0,0 +1,48 @@ + ['algorithm' => 'auto'], + ]); + $hasher = $factory->getPasswordHasher('auto'); + $hash = $hasher->hash(self::PLAIN_PASSWORD); + + $user = new User(); + $user->setUsername(self::USERNAME); + $user->setRoles([UserGroupPermissions::ROLE_SUPER_ADMIN]); + $user->setPassword($hash); + + $this->entityManager->persist($user); + $this->entityManager->flush(); + + return Command::SUCCESS; + } +} From b04932cea22e6b629a028f0bc2b630a4a7cc9b7e Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Mon, 3 Mar 2025 09:25:09 +0100 Subject: [PATCH 2/2] Changed commands output to SUCCESS --- src/Command/ChargeExampleTraceCommand.php | 2 +- src/Command/LoadDefaultCommandsCommand.php | 2 +- src/Command/LoadDefaultUserGroupsCommand.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Command/ChargeExampleTraceCommand.php b/src/Command/ChargeExampleTraceCommand.php index 414a1a7..9cef2aa 100644 --- a/src/Command/ChargeExampleTraceCommand.php +++ b/src/Command/ChargeExampleTraceCommand.php @@ -44,6 +44,6 @@ class ChargeExampleTraceCommand extends Command $this->entityManager->flush(); - return 1; + return Command::SUCCESS; } } diff --git a/src/Command/LoadDefaultCommandsCommand.php b/src/Command/LoadDefaultCommandsCommand.php index e0f8c72..1127106 100644 --- a/src/Command/LoadDefaultCommandsCommand.php +++ b/src/Command/LoadDefaultCommandsCommand.php @@ -89,7 +89,7 @@ class LoadDefaultCommandsCommand extends Command $this->entityManager->flush(); - return 1; + return Command::SUCCESS; } } \ No newline at end of file diff --git a/src/Command/LoadDefaultUserGroupsCommand.php b/src/Command/LoadDefaultUserGroupsCommand.php index 51bc6fe..0c5ab0d 100644 --- a/src/Command/LoadDefaultUserGroupsCommand.php +++ b/src/Command/LoadDefaultUserGroupsCommand.php @@ -54,6 +54,6 @@ class LoadDefaultUserGroupsCommand extends Command $this->entityManager->flush(); - return 1; + return Command::SUCCESS; } } \ No newline at end of file