mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-03-31 18:18:08 +00:00
Ajout de permissions sur le module Ticket
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user