add ROLE_MANAGER

This commit is contained in:
Simon Vieille 2022-04-16 23:28:05 +02:00
parent f34707b082
commit 4d013a4550
Signed by: deblan
GPG key ID: 03383D15A1D31745
2 changed files with 23 additions and 1 deletions

View file

@ -13,7 +13,8 @@ security:
role_hierarchy:
ROLE_WRITER: ROLE_USER
ROLE_ADMIN: ROLE_WRITER
ROLE_MANAGER: ROLE_WRITER
ROLE_ADMIN: ROLE_MANAGER
firewalls:
dev:

View file

@ -70,6 +70,11 @@ class User implements PasswordAuthenticatedUserInterface, UserInterface, TwoFact
*/
protected $isWriter;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $isManager;
public function __construct()
{
}
@ -118,6 +123,10 @@ class User implements PasswordAuthenticatedUserInterface, UserInterface, TwoFact
$roles[] = 'ROLE_ADMIN';
}
if ($this->getIsManager()) {
$roles[] = 'ROLE_MANAGER';
}
return array_unique($roles);
}
@ -247,4 +256,16 @@ class User implements PasswordAuthenticatedUserInterface, UserInterface, TwoFact
return $this;
}
public function getIsManager(): ?bool
{
return $this->isManager;
}
public function setIsManager(?bool $isManager): self
{
$this->isManager = $isManager;
return $this;
}
}