This commit is contained in:
barillote 2024-11-21 16:17:24 +01:00
parent 95aca509fc
commit fc222f516c
3 changed files with 34 additions and 1 deletions

View File

@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241121151633 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
}
}

View File

@ -28,6 +28,7 @@ class RegistrationController extends AbstractController
/** @var string $plainPassword */ /** @var string $plainPassword */
$plainPassword = $form->get('plainPassword')->getData(); $plainPassword = $form->get('plainPassword')->getData();
$user->setRoles(['ROLE_INTERN']);
// encode the plain password // encode the plain password
$user->setPassword($userPasswordHasher->hashPassword($user, $plainPassword)); $user->setPassword($userPasswordHasher->hashPassword($user, $plainPassword));
@ -55,6 +56,7 @@ class RegistrationController extends AbstractController
/** @var string $plainPassword */ /** @var string $plainPassword */
$plainPassword = $form->get('plainPassword')->getData(); $plainPassword = $form->get('plainPassword')->getData();
$user->setRoles(['ROLE_EMPLOYEE']);
// encode the plain password // encode the plain password
$user->setPassword($userPasswordHasher->hashPassword($user, $plainPassword)); $user->setPassword($userPasswordHasher->hashPassword($user, $plainPassword));

View File

@ -29,7 +29,7 @@ class UserApp implements UserInterface, PasswordAuthenticatedUserInterface
* @var list<string> The user roles * @var list<string> The user roles
*/ */
#[ORM\Column] #[ORM\Column]
private array $roles = ["ROLE_USER"]; private array $roles = [];
/** /**
* @var string The hashed password * @var string The hashed password