Some checks failed
CI/CD Pipeline / pipeline (push) Failing after 3m22s
Suite à la récupération précédente (044ca4b) qui n'avait restauré que les fichiers SUPPRIMÉS, ce commit restaure les MODIFICATIONS d'entités/services qui étaient nécessaires pour que les fichiers restaurés compilent. Restaurés depuis a72ab54^ (=31330d9+ corrections) : - Entities : Organisation, FormuleAbonnement, AuditService, MembreOrganisation, SouscriptionOrganisation, etc. - Services : MigrerOrganisationsVersKeycloakService, ComptabilitePdfService, KycAmlService, AuditService.logKycRisqueEleve, etc. - Resources : PaiementUnifieResource, etc. Backend compile désormais (BUILD SUCCESS).
56 lines
1.9 KiB
Java
56 lines
1.9 KiB
Java
package dev.lions.unionflow.server.resource;
|
|
|
|
import dev.lions.unionflow.server.api.dto.role.response.RoleResponse;
|
|
import dev.lions.unionflow.server.entity.Role;
|
|
import dev.lions.unionflow.server.service.RoleService;
|
|
import jakarta.annotation.security.RolesAllowed;
|
|
import jakarta.inject.Inject;
|
|
import jakarta.ws.rs.GET;
|
|
import jakarta.ws.rs.Path;
|
|
import jakarta.ws.rs.Produces;
|
|
import jakarta.ws.rs.core.MediaType;
|
|
import org.eclipse.microprofile.openapi.annotations.Operation;
|
|
import org.eclipse.microprofile.openapi.annotations.tags.Tag;
|
|
|
|
import java.util.List;
|
|
import java.util.stream.Collectors;
|
|
|
|
/**
|
|
* Resource REST pour les rôles.
|
|
*/
|
|
@Path("/api/roles")
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
@RolesAllowed({"ADMIN", "SUPER_ADMIN", "ADMIN_ORGANISATION"})
|
|
@Tag(name = "Rôles", description = "Gestion des rôles et permissions")
|
|
public class RoleResource {
|
|
|
|
@Inject
|
|
RoleService roleService;
|
|
|
|
@GET
|
|
@Operation(summary = "Liste tous les rôles actifs")
|
|
public List<RoleResponse> listerTous() {
|
|
return roleService.listerTousActifs().stream()
|
|
.map(this::toDTO)
|
|
.collect(Collectors.toList());
|
|
}
|
|
|
|
private RoleResponse toDTO(Role entity) {
|
|
RoleResponse dto = new RoleResponse();
|
|
dto.setId(entity.getId());
|
|
dto.setCode(entity.getCode());
|
|
dto.setLibelle(entity.getLibelle());
|
|
dto.setDescription(entity.getDescription());
|
|
dto.setTypeRole(entity.getTypeRole());
|
|
dto.setNiveauHierarchique(entity.getNiveauHierarchique());
|
|
if (entity.getOrganisation() != null) {
|
|
dto.setOrganisationId(entity.getOrganisation().getId());
|
|
dto.setNomOrganisation(entity.getOrganisation().getNom());
|
|
}
|
|
dto.setActif(entity.getActif());
|
|
dto.setDateCreation(entity.getDateCreation());
|
|
dto.setDateModification(entity.getDateModification());
|
|
return dto;
|
|
}
|
|
}
|