Loading api/src/Entity/AbstractRole.php +6 −0 Changes for api/src/Entity/AbstractRole.php: 6 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -162,7 +162,13 @@ abstract class AbstractRole implements RoleInterface public function addPrivilege(PrivilegeInterface $privilege) : void { if (!$this->privileges->contains($privilege)) { $this->privileges->add($privilege); if (!$privilege->hasRole($this)) { $privilege->addRole($this); } } } public function hasPrivilege(PrivilegeInterface $privilege) : bool Loading api/src/Entity/AbstractUser.php +16 −0 Changes for api/src/Entity/AbstractUser.php: 16 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Http\Attribute\IsGranted; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Attribute\Ignore; use Symfony\Component\Serializer\Attribute\SerializedName; use Symfony\Component\Validator\Constraints as Assert; use Unicaen\Utilisateur\Dto\UtilisateurInscriptionInput; Loading Loading @@ -161,6 +162,7 @@ abstract class AbstractUser implements UnicaenUserInterface, PasswordAuthenticat * * @return array */ #[Ignore] public function getRoles(): array { $roles = $this->roles->map(fn (Role $role) => $role->getCode())->toArray(); Loading @@ -175,8 +177,22 @@ abstract class AbstractUser implements UnicaenUserInterface, PasswordAuthenticat return $this->roles; } /** * @param iterable<\Unicaen\Utilisateur\Entity\Role> $roles */ #[Groups(['user:create', 'user:update'])] #[SerializedName('roles')] public function setRolesEntities(iterable $roles): void { $this->roles->clear(); foreach ($roles as $role) { $this->roles->add($role); } } public function addRole(RoleInterface $role): static { \trigger_error('addRole called for '.$role->getId()); if (!$this->roles->contains($role)) { $this->roles->add($role); } Loading api/src/Entity/User.php +6 −8 Changes for api/src/Entity/User.php: 6 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -40,7 +40,12 @@ use Unicaen\Utilisateur\State\UtilisateurPasswordHasherProcessor; processor: UtilisateurInscriptionProcessor::class ), new Put(processor: UtilisateurPasswordHasherProcessor::class), new Patch(processor: UtilisateurPasswordHasherProcessor::class), new Patch( denormalizationContext: [ 'groups' => ['user:update'], ], processor: UtilisateurPasswordHasherProcessor::class ), new Delete(), ], normalizationContext: ['groups' => ['user:read']], Loading @@ -53,15 +58,8 @@ use Unicaen\Utilisateur\State\UtilisateurPasswordHasherProcessor; #[ORM\Table(name: '`unicaen_utilisateur_user`')] class User extends AbstractUser { public function setRoles(array $roles): void { // TODO: Implement setRoles() method. } public function hasRole(RoleInterface $role): bool { // TODO: Implement hasRole() method. return in_array($role, $this->roles->toArray(), true); } } No newline at end of file api/src/Model/UnicaenUserInterface.php +0 −1 Changes for api/src/Model/UnicaenUserInterface.php: 0 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -8,7 +8,6 @@ interface UnicaenUserInterface extends UserInterface { public function getRoles(): array; public function setRoles(array $roles): void; public function hasRole(RoleInterface $role): bool; } frontend/dist/unicaen-utilisateur.es.js +1877 −1898 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
api/src/Entity/AbstractRole.php +6 −0 Changes for api/src/Entity/AbstractRole.php: 6 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -162,7 +162,13 @@ abstract class AbstractRole implements RoleInterface public function addPrivilege(PrivilegeInterface $privilege) : void { if (!$this->privileges->contains($privilege)) { $this->privileges->add($privilege); if (!$privilege->hasRole($this)) { $privilege->addRole($this); } } } public function hasPrivilege(PrivilegeInterface $privilege) : bool Loading
api/src/Entity/AbstractUser.php +16 −0 Changes for api/src/Entity/AbstractUser.php: 16 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Http\Attribute\IsGranted; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Attribute\Ignore; use Symfony\Component\Serializer\Attribute\SerializedName; use Symfony\Component\Validator\Constraints as Assert; use Unicaen\Utilisateur\Dto\UtilisateurInscriptionInput; Loading Loading @@ -161,6 +162,7 @@ abstract class AbstractUser implements UnicaenUserInterface, PasswordAuthenticat * * @return array */ #[Ignore] public function getRoles(): array { $roles = $this->roles->map(fn (Role $role) => $role->getCode())->toArray(); Loading @@ -175,8 +177,22 @@ abstract class AbstractUser implements UnicaenUserInterface, PasswordAuthenticat return $this->roles; } /** * @param iterable<\Unicaen\Utilisateur\Entity\Role> $roles */ #[Groups(['user:create', 'user:update'])] #[SerializedName('roles')] public function setRolesEntities(iterable $roles): void { $this->roles->clear(); foreach ($roles as $role) { $this->roles->add($role); } } public function addRole(RoleInterface $role): static { \trigger_error('addRole called for '.$role->getId()); if (!$this->roles->contains($role)) { $this->roles->add($role); } Loading
api/src/Entity/User.php +6 −8 Changes for api/src/Entity/User.php: 6 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -40,7 +40,12 @@ use Unicaen\Utilisateur\State\UtilisateurPasswordHasherProcessor; processor: UtilisateurInscriptionProcessor::class ), new Put(processor: UtilisateurPasswordHasherProcessor::class), new Patch(processor: UtilisateurPasswordHasherProcessor::class), new Patch( denormalizationContext: [ 'groups' => ['user:update'], ], processor: UtilisateurPasswordHasherProcessor::class ), new Delete(), ], normalizationContext: ['groups' => ['user:read']], Loading @@ -53,15 +58,8 @@ use Unicaen\Utilisateur\State\UtilisateurPasswordHasherProcessor; #[ORM\Table(name: '`unicaen_utilisateur_user`')] class User extends AbstractUser { public function setRoles(array $roles): void { // TODO: Implement setRoles() method. } public function hasRole(RoleInterface $role): bool { // TODO: Implement hasRole() method. return in_array($role, $this->roles->toArray(), true); } } No newline at end of file
api/src/Model/UnicaenUserInterface.php +0 −1 Changes for api/src/Model/UnicaenUserInterface.php: 0 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -8,7 +8,6 @@ interface UnicaenUserInterface extends UserInterface { public function getRoles(): array; public function setRoles(array $roles): void; public function hasRole(RoleInterface $role): bool; }
frontend/dist/unicaen-utilisateur.es.js +1877 −1898 File changed.Preview size limit exceeded, changes collapsed. Show changes