This commit is contained in:
2025-04-22 22:24:17 +02:00
parent 66b57ea84a
commit 7b05e52d95
29 changed files with 441 additions and 431 deletions

View File

@@ -27,4 +27,15 @@ class UserRepository extends ServiceEntityRepository implements PasswordUpgrader
$this->getEntityManager()->persist($user);
$this->getEntityManager()->flush();
}
public function makeAdmin(string $email): void
{
$user = $this->findOneBy(['email' => $email]);
if (!$user instanceof User) {
throw new \InvalidArgumentException('User not found');
}
$user->setRoles(['ROLE_ADMIN']);
$this->getEntityManager()->flush();
}
}