feat: Gestion des utilisateurs (invitation, blocage, déblocage)

Permet aux administrateurs d'un établissement de gérer le cycle de vie
des comptes utilisateurs : inviter de nouveaux membres, bloquer/débloquer
des comptes actifs, et renvoyer des invitations en attente.

Chaque mutation vérifie l'appartenance au tenant courant pour empêcher
les accès cross-tenant. Le blocage est restreint aux comptes actifs
uniquement et un administrateur ne peut pas bloquer son propre compte.

Les comptes suspendus reçoivent une erreur 403 spécifique au login
(sans déclencher l'escalade du rate limiting) et les tentatives sont
tracées dans les métriques Prometheus.
This commit is contained in:
2026-02-07 16:44:30 +01:00
parent ff18850a43
commit 4005c70082
58 changed files with 4443 additions and 29 deletions

View File

@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace App\Shared\Infrastructure\Tenant;
use App\Shared\Domain\Tenant\TenantId as DomainTenantId;
/**
* Builds tenant-aware URLs using the tenant subdomain and base domain.
*/
final readonly class TenantUrlBuilder
{
public function __construct(
private TenantRegistry $tenantRegistry,
private string $appUrl,
private string $baseDomain,
) {
}
public function build(DomainTenantId $tenantId, string $path): string
{
$tenantConfig = $this->tenantRegistry->getConfig(
TenantId::fromString((string) $tenantId),
);
$parsed = parse_url($this->appUrl);
$scheme = $parsed['scheme'] ?? 'https';
$port = isset($parsed['port']) ? ':' . $parsed['port'] : '';
return $scheme . '://' . $tenantConfig->subdomain . '.' . $this->baseDomain . $port . $path;
}
}