feat: superadmin attribute for extended permissions like impersonating

This commit is contained in:
Björn Fromme
2024-04-17 18:06:56 +02:00
parent 30218d6f80
commit 8b4e9f546b
4 changed files with 61 additions and 1 deletions
+15
View File
@@ -39,6 +39,9 @@ class User implements UserInterface, TimestampableEntityInterface
#[ORM\Column(type: 'json')]
private array $roles = [];
#[ORM\Column]
private bool $superAdmin = false;
#[ORM\Column(nullable: true)]
private ?\DateTimeImmutable $lastLoginAt = null;
@@ -159,6 +162,18 @@ class User implements UserInterface, TimestampableEntityInterface
return in_array($role, $this->getRoles());
}
public function isSuperAdmin(): bool
{
return $this->superAdmin;
}
public function setSuperAdmin(bool $superAdmin): static
{
$this->superAdmin = $superAdmin;
return $this;
}
public function getLastLoginAt(): ?\DateTimeImmutable
{
return $this->lastLoginAt;