['user:read']], security: "is_granted('ROLE_USER')", provider: MeProvider::class ), new Get( requirements: ['id' => '\d+'], normalizationContext: ['groups' => ['user:read']], security: "is_granted('ROLE_USER')" ), new Post( normalizationContext: ['groups' => ['user:read']], denormalizationContext: ['groups' => ['user:write']], security: "is_granted('ROLE_ADMIN')", processor: UserPasswordProcessor::class ), new Patch( normalizationContext: ['groups' => ['user:read']], denormalizationContext: ['groups' => ['user:write']], security: "is_granted('ROLE_ADMIN')", processor: UserPasswordProcessor::class ), new GetCollection( normalizationContext: ['groups' => ['user-login:read']], security: "is_granted('PUBLIC_ACCESS')" ), new GetCollection( uriTemplate: '/admin/users', normalizationContext: ['groups' => ['user:read']], security: "is_granted('ROLE_ADMIN')" ), ], normalizationContext: ['groups' => ['user:read']], paginationEnabled: false )] class User implements UserInterface, PasswordAuthenticatedUserInterface { #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] #[Groups(['user:read', 'user-login:read', 'reception:read', 'shipment:read'])] private ?int $id = null; #[ORM\Column(length: 180, unique: true)] #[Groups(['user:read', 'user:write', 'user-login:read', 'reception:read', 'shipment:read'])] private string $username = ''; #[ORM\Column(type: 'json')] #[Groups(['user:write', 'user:read'])] private array $roles = []; #[ORM\Column] #[Groups(['user:write'])] private string $password = ''; 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 getUserIdentifier(): string { return $this->username; } public function getRoles(): array { $roles = $this->roles; $roles[] = 'ROLE_USER'; return array_unique($roles); } public function setRoles(array $roles): self { $this->roles = $roles; return $this; } public function getPassword(): string { return $this->password; } public function setPassword(string $password): self { $this->password = $password; return $this; } public function eraseCredentials(): void { // No-op: we don't store temporary sensitive data on the entity. } }