feat(api kaz): Connexion à l'api kaz.

- Suppression des migrations, templates et configurations inutiles (ex. `compose.override.yaml`).
- Mise à jour de l'entité `User` :
  - Renommage des attributs pour correspondre aux conventions (`emailDeSecours` → `alternateEmail`, etc.).
  - Implémentation d'un mapper `updateFromKazUser` pour synchroniser les données depuis l'API Kaz.
- Refactorisation des migrations pour aligner les changements de schéma.
- Mise à jour du formulaire utilisateur et des fixtures en conséquence.
- Ajout du template Twig `profil_infos.html.twig` pour afficher les informations utilisateur. (A supprimer)
This commit is contained in:
MLeveque
2026-03-29 13:45:07 +02:00
parent 23789ab33e
commit e7e6d7c1af
16 changed files with 153 additions and 159 deletions

View File

@@ -12,14 +12,16 @@ use Symfony\Component\Uid\Uuid;
#[ORM\Entity(repositoryClass: UserRepository::class)]
#[ORM\Table(name: '`user`')]
#[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_EMAIL', fields: ['email'])]
#[UniqueEntity(fields: ['email'], message: 'There is already an account with this email')]
class User implements UserInterface, PasswordAuthenticatedUserInterface
{
public const string EMAIL_QUOTA_DEFAULT = '1G';
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
#[ORM\Column(type: 'uuid', unique: true)]
#[ORM\Column(type: 'uuid', unique: true, name: 'id')]
private ?Uuid $id;
#[ORM\Column(length: 180, unique: true)]
@@ -28,51 +30,56 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
/**
* @var list<string> The user roles
*/
#[ORM\Column]
#[ORM\Column(name: 'roles')]
private array $roles = [];
/**
* @var ?string The hashed password
*/
#[ORM\Column]
#[ORM\Column(name: 'password')]
private ?string $password = null;
#[ORM\Column(length: 255)]
private ?string $emailQuota = '1G';
#[ORM\Column(length: 255, name: 'email_quota')]
private ?string $emailQuota = null;
#[ORM\Column(length: 255)]
private ?string $emailDeSecours = null;
#[ORM\Column(length: 255, name: 'alternate_email')]
private ?string $alternateEmail = null;
#[ORM\Column(length: 255)]
#[ORM\Column(length: 255, name: 'identifiant_kaz')]
private ?string $identifiantKaz = null;
#[ORM\Column(length: 255)]
#[ORM\Column(length: 255, name: 'quota')]
private ?string $quota = null;
#[ORM\Column]
#[ORM\Column(name: 'has_nextcloud_access')]
private ?bool $hasNextcloudAccess = null;
#[ORM\Column(length: 255)]
#[ORM\Column(length: 255, name: 'nextcloud_quota')]
private ?string $nextcloudQuota = null;
#[ORM\Column]
#[ORM\Column(name: 'has_mobilizon')]
private ?bool $hasMobilizon = null;
#[ORM\Column]
#[ORM\Column(name: 'has_agora_access')]
private ?bool $hasAgoraAccess = null;
#[ORM\Column(length: 255)]
#[ORM\Column(length: 255, name: 'last_name')]
private ?string $lastName = null;
#[ORM\Column(length: 255)]
#[ORM\Column(length: 255, name: 'first_name')]
private ?string $firstName = null;
#[ORM\Column(length: 255, nullable: true)]
// TODO: Modifier "photo" par "image"
#[ORM\Column(length: 255, nullable: true, name: 'photo')]
private ?string $photo = null;
#[ORM\Column(length: 20, nullable: true)]
#[ORM\Column(length: 20, nullable: true, name: 'telephone')]
private ?string $telephone = null;
public function __construct() {
$this->emailQuota = self::EMAIL_QUOTA_DEFAULT;
}
public function getId(): ?Uuid
{
return $this->id;
@@ -175,14 +182,14 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
return $this;
}
public function getEmailDeSecours(): ?string
public function getAlternateEmail(): ?string
{
return $this->emailDeSecours;
return $this->alternateEmail;
}
public function setEmailDeSecours(string $emailDeSecours): static
public function setAlternateEmail(string $alternateEmail): static
{
$this->emailDeSecours = $emailDeSecours;
$this->alternateEmail = $alternateEmail;
return $this;
}
@@ -306,4 +313,19 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
return $this;
}
public function updateFromKazUser($kazUser) : User
{
$this->setEmail($kazUser['mail']);
// Création du firstname et lastname
$name = explode(' ', $kazUser['sn']);
$this->setFirstName($name[0]);
// Récupération des valeurs du tableau moins la première
$aLastname = array_slice($name, 1);
$this->setLastName(implode(' ', $aLastname));
//TODO: Ajouter les champs manquants de l'objet User dans l'api kaz.
return $this;
}
}