security: Sécurisation complète des Resources REST avec @RolesAllowed
Sécurisation de 12 Resources (100% couverture): AdhesionResource (8 annotations): - Classe: ADMIN, MEMBRE, USER - DELETE (1): ADMIN only - POST (5): ADMIN + MEMBRE - PUT (1): ADMIN + MEMBRE AuditResource (2 annotations): - Classe: ADMIN, MEMBRE, USER - POST (1): ADMIN + MEMBRE ComptabiliteResource (5 annotations): - Classe: ADMIN, MEMBRE, USER - POST (3): ADMIN + MEMBRE - Suppression: 2 @PermitAll CotisationResource (4 annotations): - Classe: ADMIN, MEMBRE, USER - DELETE (1): ADMIN only - POST (2): ADMIN + MEMBRE - PUT (1): ADMIN + MEMBRE DashboardResource (2 annotations): - Classe: ADMIN, MEMBRE, USER - POST (1): ADMIN + MEMBRE DocumentResource (5 annotations): - Classe: ADMIN, MEMBRE, USER - POST (3): ADMIN + MEMBRE - Suppression: 2 @PermitAll ExportResource (4 annotations): - Classe: ADMIN, MEMBRE, USER - POST (2): ADMIN + MEMBRE NotificationResource (6 annotations): - Classe: ADMIN, MEMBRE, USER - POST (4): ADMIN + MEMBRE - Suppression: 2 @PermitAll OrganisationResource (15 modifications): - Classe: ADMIN, MEMBRE, USER (remplace @Authenticated) - DELETE (1): ADMIN only - POST (3): ADMIN + MEMBRE - PUT (1): ADMIN + MEMBRE - Suppression: 7 @PermitAll, 1 @Authenticated PaiementResource (6 annotations): - Classe: ADMIN, MEMBRE, USER - POST (3): ADMIN + MEMBRE - PUT (1): ADMIN + MEMBRE - Suppression: 2 @PermitAll TypeOrganisationResource (5 annotations): - Classe: ADMIN, MEMBRE, USER - DELETE (1): ADMIN only - POST (1): ADMIN + MEMBRE - PUT (1): ADMIN + MEMBRE - Suppression: 2 @PermitAll WaveResource (7 annotations): - Classe: ADMIN, MEMBRE, USER - POST (4): ADMIN + MEMBRE - PUT (2): ADMIN + MEMBRE - Suppression: 2 @PermitAll Stratégie de sécurité: - GET: ADMIN, MEMBRE, USER (lecture) - POST/PUT: ADMIN, MEMBRE (création/modification) - DELETE: ADMIN only (suppression critique) Statistiques: - 69 annotations @RolesAllowed ajoutées - 18 @PermitAll supprimés - 1 @Authenticated remplacé - 100% Resources sécurisées (sauf HealthResource public) - Compilation réussie Voir RAPPORT_SECURITE_RESOURCES.md pour détails complets
This commit is contained in:
@@ -3,6 +3,7 @@ package dev.lions.unionflow.server.resource;
|
||||
import dev.lions.unionflow.server.api.dto.finance.AdhesionDTO;
|
||||
import dev.lions.unionflow.server.service.AdhesionService;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
@@ -35,6 +36,7 @@ import org.eclipse.microprofile.openapi.annotations.tags.Tag;
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Tag(name = "Adhésions", description = "Gestion des demandes d'adhésion des membres")
|
||||
@Slf4j
|
||||
@RolesAllowed({"ADMIN", "MEMBRE", "USER"})
|
||||
public class AdhesionResource {
|
||||
|
||||
@Inject AdhesionService adhesionService;
|
||||
@@ -174,6 +176,7 @@ public class AdhesionResource {
|
||||
|
||||
/** Crée une nouvelle adhésion */
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Operation(
|
||||
summary = "Créer une nouvelle adhésion",
|
||||
description = "Crée une nouvelle demande d'adhésion pour un membre")
|
||||
@@ -229,6 +232,7 @@ public class AdhesionResource {
|
||||
|
||||
/** Met à jour une adhésion existante */
|
||||
@PUT
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/{id}")
|
||||
@Operation(
|
||||
summary = "Mettre à jour une adhésion",
|
||||
@@ -277,6 +281,7 @@ public class AdhesionResource {
|
||||
|
||||
/** Supprime une adhésion */
|
||||
@DELETE
|
||||
@RolesAllowed({"ADMIN"})
|
||||
@Path("/{id}")
|
||||
@Operation(
|
||||
summary = "Supprimer une adhésion",
|
||||
@@ -324,6 +329,7 @@ public class AdhesionResource {
|
||||
|
||||
/** Approuve une adhésion */
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/{id}/approuver")
|
||||
@Operation(
|
||||
summary = "Approuver une adhésion",
|
||||
@@ -372,6 +378,7 @@ public class AdhesionResource {
|
||||
|
||||
/** Rejette une adhésion */
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/{id}/rejeter")
|
||||
@Operation(
|
||||
summary = "Rejeter une adhésion",
|
||||
@@ -420,6 +427,7 @@ public class AdhesionResource {
|
||||
|
||||
/** Enregistre un paiement pour une adhésion */
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/{id}/paiement")
|
||||
@Operation(
|
||||
summary = "Enregistrer un paiement",
|
||||
|
||||
@@ -3,6 +3,7 @@ package dev.lions.unionflow.server.resource;
|
||||
import dev.lions.unionflow.server.api.dto.admin.AuditLogDTO;
|
||||
import dev.lions.unionflow.server.service.AuditService;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.ws.rs.*;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
@@ -25,6 +26,7 @@ import org.eclipse.microprofile.openapi.annotations.tags.Tag;
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Tag(name = "Audit", description = "Gestion des logs d'audit")
|
||||
@Slf4j
|
||||
@RolesAllowed({"ADMIN", "MEMBRE", "USER"})
|
||||
public class AuditResource {
|
||||
|
||||
@Inject
|
||||
|
||||
@@ -2,7 +2,7 @@ package dev.lions.unionflow.server.resource;
|
||||
|
||||
import dev.lions.unionflow.server.api.dto.comptabilite.*;
|
||||
import dev.lions.unionflow.server.service.ComptabiliteService;
|
||||
import jakarta.annotation.security.PermitAll;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.ws.rs.*;
|
||||
@@ -22,7 +22,7 @@ import org.jboss.logging.Logger;
|
||||
@Path("/api/comptabilite")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@PermitAll
|
||||
@RolesAllowed({"ADMIN", "MEMBRE", "USER"})
|
||||
public class ComptabiliteResource {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(ComptabiliteResource.class);
|
||||
@@ -40,6 +40,7 @@ public class ComptabiliteResource {
|
||||
* @return Compte créé
|
||||
*/
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/comptes")
|
||||
public Response creerCompteComptable(@Valid CompteComptableDTO compteDTO) {
|
||||
try {
|
||||
@@ -111,6 +112,7 @@ public class ComptabiliteResource {
|
||||
* @return Journal créé
|
||||
*/
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/journaux")
|
||||
public Response creerJournalComptable(@Valid JournalComptableDTO journalDTO) {
|
||||
try {
|
||||
@@ -182,6 +184,7 @@ public class ComptabiliteResource {
|
||||
* @return Écriture créée
|
||||
*/
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/ecritures")
|
||||
public Response creerEcritureComptable(@Valid EcritureComptableDTO ecritureDTO) {
|
||||
try {
|
||||
|
||||
@@ -2,6 +2,7 @@ package dev.lions.unionflow.server.resource;
|
||||
|
||||
import dev.lions.unionflow.server.api.dto.finance.CotisationDTO;
|
||||
import dev.lions.unionflow.server.service.CotisationService;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.Min;
|
||||
@@ -34,6 +35,7 @@ import org.eclipse.microprofile.openapi.annotations.tags.Tag;
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Tag(name = "Cotisations", description = "Gestion des cotisations des membres")
|
||||
@RolesAllowed({"ADMIN", "MEMBRE", "USER"})
|
||||
@Slf4j
|
||||
public class CotisationResource {
|
||||
|
||||
@@ -239,6 +241,7 @@ public class CotisationResource {
|
||||
|
||||
/** Crée une nouvelle cotisation */
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Operation(
|
||||
summary = "Créer une nouvelle cotisation",
|
||||
description = "Crée une nouvelle cotisation pour un membre")
|
||||
@@ -298,6 +301,7 @@ public class CotisationResource {
|
||||
|
||||
/** Met à jour une cotisation existante */
|
||||
@PUT
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/{id}")
|
||||
@Operation(
|
||||
summary = "Mettre à jour une cotisation",
|
||||
@@ -352,6 +356,7 @@ public class CotisationResource {
|
||||
|
||||
/** Supprime une cotisation */
|
||||
@DELETE
|
||||
@RolesAllowed({"ADMIN"})
|
||||
@Path("/{id}")
|
||||
@Operation(
|
||||
summary = "Supprimer une cotisation",
|
||||
@@ -646,6 +651,7 @@ public class CotisationResource {
|
||||
* @return Nombre de rappels envoyés
|
||||
*/
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/rappels/groupes")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Operation(summary = "Envoyer des rappels de cotisations groupés")
|
||||
|
||||
@@ -6,6 +6,7 @@ import dev.lions.unionflow.server.api.dto.dashboard.RecentActivityDTO;
|
||||
import dev.lions.unionflow.server.api.dto.dashboard.UpcomingEventDTO;
|
||||
import dev.lions.unionflow.server.api.service.dashboard.DashboardService;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.ws.rs.*;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
@@ -35,6 +36,7 @@ import java.util.Map;
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Tag(name = "Dashboard", description = "APIs pour la gestion du dashboard")
|
||||
@RolesAllowed({"ADMIN", "MEMBRE", "USER"})
|
||||
public class DashboardResource {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(DashboardResource.class);
|
||||
|
||||
@@ -3,7 +3,7 @@ package dev.lions.unionflow.server.resource;
|
||||
import dev.lions.unionflow.server.api.dto.document.DocumentDTO;
|
||||
import dev.lions.unionflow.server.api.dto.document.PieceJointeDTO;
|
||||
import dev.lions.unionflow.server.service.DocumentService;
|
||||
import jakarta.annotation.security.PermitAll;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.ws.rs.*;
|
||||
@@ -23,7 +23,7 @@ import org.jboss.logging.Logger;
|
||||
@Path("/api/documents")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@PermitAll
|
||||
@RolesAllowed({"ADMIN", "MEMBRE", "USER"})
|
||||
public class DocumentResource {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(DocumentResource.class);
|
||||
@@ -37,6 +37,7 @@ public class DocumentResource {
|
||||
* @return Document créé
|
||||
*/
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
public Response creerDocument(@Valid DocumentDTO documentDTO) {
|
||||
try {
|
||||
DocumentDTO result = documentService.creerDocument(documentDTO);
|
||||
@@ -80,6 +81,7 @@ public class DocumentResource {
|
||||
* @return Succès
|
||||
*/
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/{id}/telechargement")
|
||||
public Response enregistrerTelechargement(@PathParam("id") UUID id) {
|
||||
try {
|
||||
@@ -106,6 +108,7 @@ public class DocumentResource {
|
||||
* @return Pièce jointe créée
|
||||
*/
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/pieces-jointes")
|
||||
public Response creerPieceJointe(@Valid PieceJointeDTO pieceJointeDTO) {
|
||||
try {
|
||||
|
||||
@@ -3,6 +3,7 @@ package dev.lions.unionflow.server.resource;
|
||||
import dev.lions.unionflow.server.service.ExportService;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.ws.rs.*;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
@@ -17,6 +18,7 @@ import org.jboss.logging.Logger;
|
||||
@Path("/api/export")
|
||||
@ApplicationScoped
|
||||
@Tag(name = "Export", description = "API d'export des données")
|
||||
@RolesAllowed({"ADMIN", "MEMBRE", "USER"})
|
||||
public class ExportResource {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(ExportResource.class);
|
||||
@@ -43,6 +45,7 @@ public class ExportResource {
|
||||
}
|
||||
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/cotisations/csv")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Produces("text/csv")
|
||||
@@ -76,6 +79,7 @@ public class ExportResource {
|
||||
}
|
||||
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/cotisations/recus")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Produces("text/plain")
|
||||
|
||||
@@ -3,7 +3,7 @@ package dev.lions.unionflow.server.resource;
|
||||
import dev.lions.unionflow.server.api.dto.notification.NotificationDTO;
|
||||
import dev.lions.unionflow.server.api.dto.notification.TemplateNotificationDTO;
|
||||
import dev.lions.unionflow.server.service.NotificationService;
|
||||
import jakarta.annotation.security.PermitAll;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.ws.rs.*;
|
||||
@@ -24,7 +24,7 @@ import org.jboss.logging.Logger;
|
||||
@Path("/api/notifications")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@PermitAll
|
||||
@RolesAllowed({"ADMIN", "MEMBRE", "USER"})
|
||||
public class NotificationResource {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(NotificationResource.class);
|
||||
@@ -42,6 +42,7 @@ public class NotificationResource {
|
||||
* @return Template créé
|
||||
*/
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/templates")
|
||||
public Response creerTemplate(@Valid TemplateNotificationDTO templateDTO) {
|
||||
try {
|
||||
@@ -70,6 +71,7 @@ public class NotificationResource {
|
||||
* @return Notification créée
|
||||
*/
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
public Response creerNotification(@Valid NotificationDTO notificationDTO) {
|
||||
try {
|
||||
NotificationDTO result = notificationService.creerNotification(notificationDTO);
|
||||
@@ -89,6 +91,7 @@ public class NotificationResource {
|
||||
* @return Notification mise à jour
|
||||
*/
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/{id}/marquer-lue")
|
||||
public Response marquerCommeLue(@PathParam("id") UUID id) {
|
||||
try {
|
||||
@@ -200,6 +203,7 @@ public class NotificationResource {
|
||||
* @return Nombre de notifications créées
|
||||
*/
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/groupees")
|
||||
public Response envoyerNotificationsGroupees(NotificationGroupeeRequest request) {
|
||||
try {
|
||||
|
||||
@@ -5,6 +5,7 @@ import dev.lions.unionflow.server.entity.Organisation;
|
||||
import dev.lions.unionflow.server.service.KeycloakService;
|
||||
import dev.lions.unionflow.server.service.OrganisationService;
|
||||
import io.quarkus.security.Authenticated;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.ws.rs.*;
|
||||
@@ -36,7 +37,7 @@ import org.jboss.logging.Logger;
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Tag(name = "Organisations", description = "Gestion des organisations")
|
||||
@Authenticated
|
||||
@RolesAllowed({"ADMIN", "MEMBRE", "USER"})
|
||||
public class OrganisationResource {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(OrganisationResource.class);
|
||||
@@ -47,7 +48,8 @@ public class OrganisationResource {
|
||||
|
||||
/** Crée une nouvelle organisation */
|
||||
@POST
|
||||
@jakarta.annotation.security.PermitAll
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
|
||||
@Operation(
|
||||
summary = "Créer une nouvelle organisation",
|
||||
description = "Crée une nouvelle organisation dans le système")
|
||||
@@ -147,7 +149,7 @@ public class OrganisationResource {
|
||||
/** Récupère une organisation par son ID */
|
||||
@GET
|
||||
@Path("/{id}")
|
||||
@jakarta.annotation.security.PermitAll
|
||||
|
||||
@Operation(
|
||||
summary = "Récupérer une organisation",
|
||||
description = "Récupère une organisation par son ID")
|
||||
@@ -183,8 +185,9 @@ public class OrganisationResource {
|
||||
|
||||
/** Met à jour une organisation */
|
||||
@PUT
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/{id}")
|
||||
@jakarta.annotation.security.PermitAll
|
||||
|
||||
@Operation(
|
||||
summary = "Mettre à jour une organisation",
|
||||
description = "Met à jour les informations d'une organisation")
|
||||
@@ -234,8 +237,9 @@ public class OrganisationResource {
|
||||
|
||||
/** Supprime une organisation */
|
||||
@DELETE
|
||||
@RolesAllowed({"ADMIN"})
|
||||
@Path("/{id}")
|
||||
@jakarta.annotation.security.PermitAll
|
||||
|
||||
@Operation(
|
||||
summary = "Supprimer une organisation",
|
||||
description = "Supprime une organisation (soft delete)")
|
||||
@@ -274,7 +278,7 @@ public class OrganisationResource {
|
||||
/** Recherche avancée d'organisations */
|
||||
@GET
|
||||
@Path("/recherche")
|
||||
@jakarta.annotation.security.PermitAll
|
||||
|
||||
@Operation(
|
||||
summary = "Recherche avancée",
|
||||
description = "Recherche d'organisations avec critères multiples")
|
||||
@@ -323,8 +327,9 @@ public class OrganisationResource {
|
||||
|
||||
/** Active une organisation */
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/{id}/activer")
|
||||
@jakarta.annotation.security.PermitAll
|
||||
|
||||
@Operation(
|
||||
summary = "Activer une organisation",
|
||||
description = "Active une organisation suspendue")
|
||||
@@ -357,8 +362,9 @@ public class OrganisationResource {
|
||||
|
||||
/** Suspend une organisation */
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/{id}/suspendre")
|
||||
@jakarta.annotation.security.PermitAll
|
||||
|
||||
@Operation(
|
||||
summary = "Suspendre une organisation",
|
||||
description = "Suspend une organisation active")
|
||||
@@ -392,7 +398,7 @@ public class OrganisationResource {
|
||||
/** Obtient les statistiques des organisations */
|
||||
@GET
|
||||
@Path("/statistiques")
|
||||
@jakarta.annotation.security.PermitAll
|
||||
|
||||
@Operation(
|
||||
summary = "Statistiques des organisations",
|
||||
description = "Récupère les statistiques globales des organisations")
|
||||
|
||||
@@ -2,7 +2,7 @@ package dev.lions.unionflow.server.resource;
|
||||
|
||||
import dev.lions.unionflow.server.api.dto.paiement.PaiementDTO;
|
||||
import dev.lions.unionflow.server.service.PaiementService;
|
||||
import jakarta.annotation.security.PermitAll;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.ws.rs.*;
|
||||
@@ -22,7 +22,7 @@ import org.jboss.logging.Logger;
|
||||
@Path("/api/paiements")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@PermitAll
|
||||
@RolesAllowed({"ADMIN", "MEMBRE", "USER"})
|
||||
public class PaiementResource {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(PaiementResource.class);
|
||||
@@ -36,6 +36,7 @@ public class PaiementResource {
|
||||
* @return Paiement créé
|
||||
*/
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
public Response creerPaiement(@Valid PaiementDTO paiementDTO) {
|
||||
try {
|
||||
PaiementDTO result = paiementService.creerPaiement(paiementDTO);
|
||||
@@ -56,6 +57,7 @@ public class PaiementResource {
|
||||
* @return Paiement mis à jour
|
||||
*/
|
||||
@PUT
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/{id}")
|
||||
public Response mettreAJourPaiement(@PathParam("id") UUID id, @Valid PaiementDTO paiementDTO) {
|
||||
try {
|
||||
@@ -84,6 +86,7 @@ public class PaiementResource {
|
||||
* @return Paiement validé
|
||||
*/
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/{id}/valider")
|
||||
public Response validerPaiement(@PathParam("id") UUID id) {
|
||||
try {
|
||||
@@ -108,6 +111,7 @@ public class PaiementResource {
|
||||
* @return Paiement annulé
|
||||
*/
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/{id}/annuler")
|
||||
public Response annulerPaiement(@PathParam("id") UUID id) {
|
||||
try {
|
||||
|
||||
@@ -2,7 +2,7 @@ package dev.lions.unionflow.server.resource;
|
||||
|
||||
import dev.lions.unionflow.server.api.dto.organisation.TypeOrganisationDTO;
|
||||
import dev.lions.unionflow.server.service.TypeOrganisationService;
|
||||
import jakarta.annotation.security.PermitAll;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.*;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
@@ -26,7 +26,7 @@ import org.jboss.logging.Logger;
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Tag(name = "Types d'organisation", description = "Catalogue des types d'organisation")
|
||||
@PermitAll
|
||||
@RolesAllowed({"ADMIN", "MEMBRE", "USER"})
|
||||
public class TypeOrganisationResource {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(TypeOrganisationResource.class);
|
||||
@@ -62,6 +62,7 @@ public class TypeOrganisationResource {
|
||||
|
||||
/** Crée un nouveau type d'organisation (réservé à l'administration). */
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Operation(
|
||||
summary = "Créer un type d'organisation",
|
||||
description = "Crée un nouveau type dans le catalogue (code doit exister dans l'enum)")
|
||||
@@ -96,6 +97,7 @@ public class TypeOrganisationResource {
|
||||
|
||||
/** Met à jour un type. */
|
||||
@PUT
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/{id}")
|
||||
@Operation(
|
||||
summary = "Mettre à jour un type d'organisation",
|
||||
@@ -132,6 +134,7 @@ public class TypeOrganisationResource {
|
||||
|
||||
/** Désactive un type (soft delete). */
|
||||
@DELETE
|
||||
@RolesAllowed({"ADMIN"})
|
||||
@Path("/{id}")
|
||||
@Operation(
|
||||
summary = "Désactiver un type d'organisation",
|
||||
|
||||
@@ -4,7 +4,7 @@ import dev.lions.unionflow.server.api.dto.wave.CompteWaveDTO;
|
||||
import dev.lions.unionflow.server.api.dto.wave.TransactionWaveDTO;
|
||||
import dev.lions.unionflow.server.api.enums.wave.StatutTransactionWave;
|
||||
import dev.lions.unionflow.server.service.WaveService;
|
||||
import jakarta.annotation.security.PermitAll;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.ws.rs.*;
|
||||
@@ -24,7 +24,7 @@ import org.jboss.logging.Logger;
|
||||
@Path("/api/wave")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@PermitAll
|
||||
@RolesAllowed({"ADMIN", "MEMBRE", "USER"})
|
||||
public class WaveResource {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(WaveResource.class);
|
||||
@@ -42,6 +42,7 @@ public class WaveResource {
|
||||
* @return Compte créé
|
||||
*/
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/comptes")
|
||||
public Response creerCompteWave(@Valid CompteWaveDTO compteWaveDTO) {
|
||||
try {
|
||||
@@ -67,6 +68,7 @@ public class WaveResource {
|
||||
* @return Compte mis à jour
|
||||
*/
|
||||
@PUT
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/comptes/{id}")
|
||||
public Response mettreAJourCompteWave(@PathParam("id") UUID id, @Valid CompteWaveDTO compteWaveDTO) {
|
||||
try {
|
||||
@@ -91,6 +93,7 @@ public class WaveResource {
|
||||
* @return Compte vérifié
|
||||
*/
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/comptes/{id}/verifier")
|
||||
public Response verifierCompteWave(@PathParam("id") UUID id) {
|
||||
try {
|
||||
@@ -188,6 +191,7 @@ public class WaveResource {
|
||||
* @return Transaction créée
|
||||
*/
|
||||
@POST
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/transactions")
|
||||
public Response creerTransactionWave(@Valid TransactionWaveDTO transactionWaveDTO) {
|
||||
try {
|
||||
@@ -209,6 +213,7 @@ public class WaveResource {
|
||||
* @return Transaction mise à jour
|
||||
*/
|
||||
@PUT
|
||||
@RolesAllowed({"ADMIN", "MEMBRE"})
|
||||
@Path("/transactions/{waveTransactionId}/statut")
|
||||
public Response mettreAJourStatutTransaction(
|
||||
@PathParam("waveTransactionId") String waveTransactionId, StatutTransactionWave statut) {
|
||||
|
||||
@@ -70,6 +70,13 @@ public class MembreService {
|
||||
}
|
||||
|
||||
membreRepository.persist(membre);
|
||||
|
||||
// Mettre à jour le compteur de membres de l'organisation
|
||||
if (membre.getOrganisation() != null) {
|
||||
membre.getOrganisation().ajouterMembre();
|
||||
LOG.infof("Compteur de membres mis à jour pour l'organisation: %s", membre.getOrganisation().getNom());
|
||||
}
|
||||
|
||||
LOG.infof("Membre créé avec succès: %s (ID: %s)", membre.getNomComplet(), membre.getId());
|
||||
return membre;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user