fix(security): audit RBAC complet v3.0 — rôles normalisés, lifecycle, changement mdp mobile
RBAC:
- HealthResource: @PermitAll
- RoleResource: @RolesAllowed ADMIN/SUPER_ADMIN/ADMIN_ORGANISATION class-level
- PropositionAideResource: @RolesAllowed MEMBRE/USER class-level
- AuthCallbackResource: @PermitAll
- EvenementResource: @PermitAll /publics et /test, count restreint
- BackupResource/LogsMonitoringResource/SystemResource: MODERATOR → MODERATEUR
- AnalyticsResource: MANAGER/MEMBER → ADMIN_ORGANISATION/MEMBRE
- RoleConstant.java: constantes de rôles centralisées
Cycle de vie membres:
- MemberLifecycleService: ajouterMembre()/retirerMembre() sur activation/radiation/archivage
- MembreResource: endpoint GET /numero/{numeroMembre}
- MembreService: méthode trouverParNumeroMembre()
Changement mot de passe:
- CompteAdherentResource: endpoint POST /auth/change-password (mobile)
- MembreKeycloakSyncService: changerMotDePasseDirectKeycloak() via API Admin Keycloak directe
- Fallback automatique si lions-user-manager indisponible
Workflow:
- Flyway V17-V23: rôles, types org, formules Option C, lifecycle columns, bareme cotisation
- Nouvelles classes: MemberLifecycleService, OrganisationModuleService, scheduler
- Security: OrganisationContextFilter, OrganisationContextHolder, ModuleAccessFilter
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
package dev.lions.unionflow.server.security;
|
||||
|
||||
import dev.lions.unionflow.server.entity.Organisation;
|
||||
import jakarta.enterprise.context.RequestScoped;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Holder request-scoped contenant l'organisation active résolue pour la requête courante.
|
||||
*
|
||||
* <p>Peuplé par {@link OrganisationContextFilter} à partir du header
|
||||
* {@code X-Active-Organisation-Id}. Utilisé par les services métier pour
|
||||
* scoper toutes les opérations à l'organisation active.
|
||||
*
|
||||
* <p>Exemple d'utilisation dans un service :
|
||||
* <pre>{@code
|
||||
* @Inject OrganisationContextHolder orgContext;
|
||||
*
|
||||
* public List<Tontine> listTontines() {
|
||||
* UUID orgId = orgContext.getOrganisationId();
|
||||
* return tontineRepository.findByOrganisationId(orgId);
|
||||
* }
|
||||
* }</pre>
|
||||
*/
|
||||
@RequestScoped
|
||||
public class OrganisationContextHolder {
|
||||
|
||||
private UUID organisationId;
|
||||
private Organisation organisation;
|
||||
private boolean resolved = false;
|
||||
|
||||
public UUID getOrganisationId() {
|
||||
return organisationId;
|
||||
}
|
||||
|
||||
public void setOrganisationId(UUID organisationId) {
|
||||
this.organisationId = organisationId;
|
||||
}
|
||||
|
||||
public Organisation getOrganisation() {
|
||||
return organisation;
|
||||
}
|
||||
|
||||
public void setOrganisation(Organisation organisation) {
|
||||
this.organisation = organisation;
|
||||
}
|
||||
|
||||
public boolean isResolved() {
|
||||
return resolved;
|
||||
}
|
||||
|
||||
public void setResolved(boolean resolved) {
|
||||
this.resolved = resolved;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne true si un contexte d'organisation est disponible.
|
||||
*/
|
||||
public boolean hasContext() {
|
||||
return resolved && organisationId != null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user