feat: disable/block teamer users as admin
This commit is contained in:
+52
-1
@@ -4,6 +4,7 @@ namespace App\Entity;
|
||||
|
||||
use App\Entity\Traits\TimestampableEntity;
|
||||
use App\Repository\UserRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
@@ -57,6 +58,15 @@ class User implements UserInterface, TimestampableEntityInterface
|
||||
#[ORM\Column]
|
||||
private bool $muteNotifications = false;
|
||||
|
||||
#[ORM\Column(type: 'datetime_immutable', nullable: true)]
|
||||
private ?\DateTimeImmutable $disabledAt = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||
private ?string $disabledReason = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||
private ?string $disabledReasonInternal = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->uuid = Uuid::v4();
|
||||
@@ -169,7 +179,7 @@ class User implements UserInterface, TimestampableEntityInterface
|
||||
$labels = [];
|
||||
|
||||
foreach ($this->roles as $role) {
|
||||
$labels[] = match($role) {
|
||||
$labels[] = match ($role) {
|
||||
'ROLE_ADMIN' => 'Admin',
|
||||
'ROLE_MANAGER' => 'Reisemanager',
|
||||
'ROLE_HOUSE_MANAGER' => 'Hausleitung',
|
||||
@@ -300,4 +310,45 @@ class User implements UserInterface, TimestampableEntityInterface
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDisabledAt(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->disabledAt;
|
||||
}
|
||||
|
||||
public function setDisabledAt(?\DateTimeImmutable $disabledAt): static
|
||||
{
|
||||
$this->disabledAt = $disabledAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isDisabled(): bool
|
||||
{
|
||||
return null !== $this->disabledAt;
|
||||
}
|
||||
|
||||
public function getDisabledReason(): ?string
|
||||
{
|
||||
return $this->disabledReason;
|
||||
}
|
||||
|
||||
public function setDisabledReason(?string $disabledReason): static
|
||||
{
|
||||
$this->disabledReason = $disabledReason;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDisabledReasonInternal(): ?string
|
||||
{
|
||||
return $this->disabledReasonInternal;
|
||||
}
|
||||
|
||||
public function setDisabledReasonInternal(?string $disabledReasonInternal): static
|
||||
{
|
||||
$this->disabledReasonInternal = $disabledReasonInternal;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user