Ajout de permissions sur le module Ticket

This commit is contained in:
2026-03-23 11:44:30 +00:00
parent 63fc600be6
commit eff0f6bcda
35 changed files with 486 additions and 68 deletions

View File

@@ -133,6 +133,9 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 5, nullable: false, options: ['default' => 'fr'])]
private string $locale = 'fr';
#[ORM\ManyToMany(targetEntity: UserGroup::class, mappedBy: 'users')]
private Collection&Selectable $groupsAsMember;
/**
* User constructor.
*/
@@ -141,6 +144,7 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter
$this->groupCenters = new ArrayCollection();
$this->scopeHistories = new ArrayCollection();
$this->jobHistories = new ArrayCollection();
$this->groupsAsMember = new ArrayCollection();
}
public function __toString(): string
@@ -170,6 +174,32 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter
return $this->absenceEnd;
}
public function addGroupAsMember(UserGroup $userGroup): self
{
if (!$this->groupsAsMember->contains($userGroup)) {
$this->groupsAsMember->add($userGroup);
}
return $this;
}
public function removeGroupAsMember(UserGroup $userGroup): self
{
if ($this->groupsAsMember->contains($userGroup)) {
$this->groupsAsMember->removeElement($userGroup);
}
return $this;
}
/**
* @return Selectable&Collection<int, UserGroup>
*/
public function getGroupsAsMember(): Collection&Selectable
{
return $this->groupsAsMember;
}
/**
* Get attributes.
*