src/Entity/Vault.php line 16
<?phpnamespace App\Entity;use App\Traits\Timestamps;use App\Repository\VaultRepository;use App\Service\EncryptionService;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: VaultRepository::class)]#[ORM\Table(name: 'vault')]#[ORM\HasLifecycleCallbacks]class Vault{use Timestamps;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 255)]private ?string $projectName = null;#[ORM\Column(length: 255)]private ?string $login = null;#[ORM\Column(length: 1000)]private ?string $password = null;#[ORM\Column(length: 255, nullable: true)]private ?string $url = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $note = null;#[ORM\ManyToMany(targetEntity: User::class, inversedBy: 'vaults')]private Collection $authorizedUsers;public function __construct(){$this->authorizedUsers = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getProjectName(): ?string{return $this->projectName;}public function setProjectName(string $projectName): self{$this->projectName = $projectName;return $this;}public function getLogin(): ?string{return $this->login;}public function setLogin(string $login): self{$this->login = $login;return $this;}public function getPassword(): ?string{return $this->password;}public function setPassword(string $password): self{$this->password = $password;return $this;}public function getUrl(): ?string{return $this->url;}public function setUrl(?string $url): self{$this->url = $url;return $this;}public function getNote(): ?string{return $this->note;}public function setNote(?string $note): self{$this->note = $note;return $this;}/*** @return Collection<int, User>*/public function getAuthorizedUsers(): Collection{return $this->authorizedUsers;}public function addAuthorizedUser(User $user): self{if (!$this->authorizedUsers->contains($user)) {$this->authorizedUsers->add($user);}return $this;}public function removeAuthorizedUser(User $user): self{$this->authorizedUsers->removeElement($user);return $this;}public function hasAccess(User $user): bool{// Admin always has accessif ($user->hasRole('ROLE_SUPERUSER') || $user->hasRole('ROLE_ADMINISTRATOR')) {return true;}// Check if user is in the authorized listreturn $this->authorizedUsers->contains($user);}}