groups = new ArrayCollection(); $this->ownergroups = new ArrayCollection(); $this->modos = new ArrayCollection(); } // == CODE A NE PAS REGENERER public function setId(int $id): self { $this->id = $id; return $this; } public function getUserIdentifier(): string { return $this->username; } public function setPasswordDirect($password) { // Permet de setter le password généré lors de l'inscription $this->password = $password; return $this; } /** * @see PasswordAuthenticatedUserInterface */ public function getPassword(): string { return $this->password; } public function setPassword($password): self { if ($password != $this->password && '' != $password) { // Placer le password non encodé dans une variable tempo sur laquel on va appliquer la contraite de form $this->passwordplain = $password; // Password encrypté format openldap $this->salt = uniqid(mt_rand(), true); $hash = '{SSHA}'.base64_encode(pack('H*', sha1($password.$this->salt)).$this->salt); $this->password = $hash; } return $this; } /** * Returning a salt is only needed, if you are not using a modern * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml. * * @see UserInterface */ public function getSalt(): ?string { return $this->salt; } /** * @see UserInterface */ public function eraseCredentials() { $this->passwordplain = null; } public function getRoles(): array { return $this->roles; } public function hasRole(string $role): ?bool { return in_array($role, $this->getRoles()); } public function setRole(string $role): self { if (!$this->hasRole($role)) { array_push($this->roles, $role); } return $this; } public function getDisplayname() { return $this->firstname.' '.$this->lastname.(!$this->isactive ? ' (inactif)' : ''); } public function getFullname() { return $this->username.' = '.$this->firstname.' '.$this->lastname.(!$this->isactive ? ' (inactif)' : ''); } // == FIN DU CODE A NE PAS REGENERER public function getId(): ?int { return $this->id; } public function getUsername(): ?string { return $this->username; } public function setUsername(string $username): self { $this->username = $username; return $this; } public function getApikey(): ?string { return $this->apikey; } public function setApikey(string $apikey): self { $this->apikey = $apikey; return $this; } public function getFirstname(): ?string { return $this->firstname; } public function setFirstname(?string $firstname): self { $this->firstname = $firstname; return $this; } public function getLastname(): ?string { return $this->lastname; } public function setLastname(?string $lastname): self { $this->lastname = $lastname; return $this; } public function setRoles(array $roles): self { $this->roles = $roles; return $this; } public function setSalt(string $salt): self { $this->salt = $salt; return $this; } public function getEmail(): ?string { return $this->email; } public function setEmail(string $email): self { $this->email = $email; return $this; } public function getAvatar(): ?string { return $this->avatar; } public function setAvatar(?string $avatar): self { $this->avatar = $avatar; return $this; } public function isIsvisible(): ?bool { return $this->isvisible; } public function setIsvisible(bool $isvisible): self { $this->isvisible = $isvisible; return $this; } public function getPostaladress(): ?string { return $this->postaladress; } public function setPostaladress(?string $postaladress): self { $this->postaladress = $postaladress; return $this; } public function getTelephonenumber(): ?string { return $this->telephonenumber; } public function setTelephonenumber(?string $telephonenumber): self { $this->telephonenumber = $telephonenumber; return $this; } public function getJob(): ?string { return $this->job; } public function setJob(?string $job): self { $this->job = $job; return $this; } public function getPosition(): ?string { return $this->position; } public function setPosition(?string $position): self { $this->position = $position; return $this; } public function getMotivation(): ?string { return $this->motivation; } public function setMotivation(?string $motivation): self { $this->motivation = $motivation; return $this; } public function getNote(): ?string { return $this->note; } public function setNote(?string $note): self { $this->note = $note; return $this; } public function getPreference(): ?array { return $this->preference; } public function setPreference(?array $preference): self { $this->preference = $preference; return $this; } public function getKeyexpire(): ?\DateTimeInterface { return $this->keyexpire; } public function setKeyexpire(?\DateTimeInterface $keyexpire): self { $this->keyexpire = $keyexpire; return $this; } public function getKeyvalue(): ?string { return $this->keyvalue; } public function setKeyvalue(?string $keyvalue): self { $this->keyvalue = $keyvalue; return $this; } public function getVisitedate(): ?\DateTimeInterface { return $this->visitedate; } public function setVisitedate(?\DateTimeInterface $visitedate): self { $this->visitedate = $visitedate; return $this; } public function getVisitecpt(): ?int { return $this->visitecpt; } public function setVisitecpt(?int $visitecpt): self { $this->visitecpt = $visitecpt; return $this; } public function getNiveau01(): ?Niveau01 { return $this->niveau01; } public function setNiveau01(?Niveau01 $niveau01): self { $this->niveau01 = $niveau01; return $this; } public function getNiveau02(): ?Niveau02 { return $this->niveau02; } public function setNiveau02(?Niveau02 $niveau02): self { $this->niveau02 = $niveau02; return $this; } /** * @return Collection */ public function getGroups(): Collection { return $this->groups; } public function addGroup(UserGroup $group): self { if (!$this->groups->contains($group)) { $this->groups[] = $group; $group->setUser($this); } return $this; } public function removeGroup(UserGroup $group): self { if ($this->groups->removeElement($group)) { // set the owning side to null (unless already changed) if ($group->getUser() === $this) { $group->setUser(null); } } return $this; } /** * @return Collection */ public function getOwnergroups(): Collection { return $this->ownergroups; } public function addOwnergroup(Group $ownergroup): self { if (!$this->ownergroups->contains($ownergroup)) { $this->ownergroups[] = $ownergroup; $ownergroup->setOwner($this); } return $this; } public function removeOwnergroup(Group $ownergroup): self { if ($this->ownergroups->removeElement($ownergroup)) { // set the owning side to null (unless already changed) if ($ownergroup->getOwner() === $this) { $ownergroup->setOwner(null); } } return $this; } /** * @return Collection */ public function getModos(): Collection { return $this->modos; } public function addModo(UserModo $modo): self { if (!$this->modos->contains($modo)) { $this->modos[] = $modo; $modo->setUser($this); } return $this; } public function removeModo(UserModo $modo): self { if ($this->modos->removeElement($modo)) { // set the owning side to null (unless already changed) if ($modo->getUser() === $this) { $modo->setUser(null); } } return $this; } public function getNiveau03(): ?Niveau03 { return $this->niveau03; } public function setNiveau03(?Niveau03 $niveau03): self { $this->niveau03 = $niveau03; return $this; } public function getNiveau04(): ?Niveau04 { return $this->niveau04; } public function setNiveau04(?Niveau04 $niveau04): self { $this->niveau04 = $niveau04; return $this; } public function isIsactive(): ?bool { return $this->isactive; } public function setIsactive(bool $isactive): self { $this->isactive = $isactive; return $this; } }