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; } //== 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 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 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 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 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 getStatut(): ?int { return $this->statut; } public function setStatut(int $statut): self { $this->statut = $statut; 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; } }