@Test public void listResourceEndpoints() throws Exception { RestAssured.given() .accept(MediaType.APPLICATION_JSON) .header(GlobalDataRest.X_TENANT_ID, TENANT_ID) .when().options("/") .then().statusCode(Status.OK.getStatusCode()) .body(CoreMatchers.containsString("units:read")); }
@Path("/") @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Unsecured() public Response listResourceEndpoints() { String resourcePath = AccessExternalResource.class.getAnnotation(Path.class).value(); List<EndpointInfo> securedEndpointList = this.secureEndpointRegistry.getEndPointsByResourcePath(resourcePath); return Response.status(Status.OK).entity(securedEndpointList).build(); }
AccessExternalResource extends ApplicationStatusResource { @Path("/") @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Unsecured() public Response listResourceEndpoints() { String resourcePath = AccessExternalResource.class.getAnnotation(Path.class).value(); List<EndpointInfo> securedEndpointList = this.secureEndpointRegistry.getEndPointsByResourcePath(resourcePath); return Response.status(Status.OK).entity(securedEndpointList).build(); } }
AccessExternalResource extends ApplicationStatusResource { @Path("/") @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Unsecured() public Response listResourceEndpoints() { String resourcePath = AccessExternalResource.class.getAnnotation(Path.class).value(); List<EndpointInfo> securedEndpointList = this.secureEndpointRegistry.getEndPointsByResourcePath(resourcePath); return Response.status(Status.OK).entity(securedEndpointList).build(); } AccessExternalResource(SecureEndpointRegistry secureEndpointRegistry); @VisibleForTesting  AccessExternalResource(SecureEndpointRegistry secureEndpointRegistry,
        AccessInternalClientFactory accessInternalClientFactory); }
AccessExternalResource extends ApplicationStatusResource { @Path("/") @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Unsecured() public Response listResourceEndpoints() { String resourcePath = AccessExternalResource.class.getAnnotation(Path.class).value(); List<EndpointInfo> securedEndpointList = this.secureEndpointRegistry.getEndPointsByResourcePath(resourcePath); return Response.status(Status.OK).entity(securedEndpointList).build(); } AccessExternalResource(SecureEndpointRegistry secureEndpointRegistry); @VisibleForTesting  AccessExternalResource(SecureEndpointRegistry secureEndpointRegistry,
        AccessInternalClientFactory accessInternalClientFactory); @Path("/") @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Unsecured() Response listResourceEndpoints(); @GET @Path("/units") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "units:read", description = "Récupérer la liste des unités archivistiques") Response getUnits(@Dsl(value = DslSchema.SELECT_MULTIPLE) JsonNode queryJson); @POST @Path("/dipexport") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "dipexport:create", description = "Générer le DIP à partir d'un DSL") Response exportDIP(@Dsl(value = DslSchema.SELECT_MULTIPLE) JsonNode queryJson); @POST @Path("/transfers") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "transfers:create", description = "Générer le SIP pour transfer à partir d'un DSL") Response transfer(TransferRequest transferRequest); @POST @Path("/transfers/reply") @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "transfers:reply", description = "Start transfer reply workflow.") Response transferReply(InputStream transferReply); @GET @Path("/transfers/{id}/sip") @Produces(MediaType.APPLICATION_OCTET_STREAM) @Secured(permission = "transfers:id:sip:read", description = "Récupérer le SIP du transfer") Response findTransferByID(@PathParam("id") String id); @POST @Path("/reclassification") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "reclassification:update", description = "Mise à jour d'arborescence des unités archivistiques") Response reclassification(@Dsl(DslSchema.RECLASSIFICATION_QUERY) JsonNode queryJson); @POST @Path("/elimination/analysis") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "elimination:analysis", description = "Analyse de l'élimination d'unités archivistiques") Response startEliminationAnalysis(EliminationRequestBody eliminationRequestBody); @POST @Path("/elimination/action") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "elimination:action", description = "Elimination définitive d'unités archivistiques") Response startEliminationAction(EliminationRequestBody eliminationRequestBody); @GET @Path("/dipexport/{id}/dip") @Produces(MediaType.APPLICATION_OCTET_STREAM) @Secured(permission = "dipexport:id:dip:read", description = "Récupérer le DIP") Response findExportByID(@PathParam("id") String id); @GET @Path("/units/{idu}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "units:id:read:json", description = "Obtenir le détail d'une unité archivistique au format json") Response getUnitById(@Dsl(value = DslSchema.GET_BY_ID) JsonNode queryJson, @PathParam("idu") String idUnit); @PUT @Path("/units/{idu}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "units:id:update", description = "Réaliser la mise à jour d'une unité archivistique") Response updateUnitById(@Dsl(DslSchema.UPDATE_BY_ID) JsonNode queryJson, @PathParam("idu") String idUnit); @GET @Path("/units/{idu}/objects") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "units:id:objects:read:json", description = "Télécharger le groupe d'objet technique de l'unité archivistique donnée") Response getObjectGroupMetadataByUnitId(@Context HttpHeaders headers, @PathParam("idu") String unitId,
        @Dsl(value = DslSchema.GET_BY_ID) JsonNode queryJson); @GET @Path("/units/{idu}/objects") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_OCTET_STREAM) @Secured(permission = "units:id:objects:read:binary", description = "Télecharger un objet") Response getDataObjectByUnitId(@Context HttpHeaders headers, @PathParam("idu") String unitId); @POST @Path("/units") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "units:update", description = "Mise à jour en masse des unités archivistiques") Response massUpdateUnits(@Dsl(DslSchema.MASS_UPDATE) JsonNode queryJson); @POST @Path("/units/rules") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "units:rules:update", description = "Mise à jour en masse des règles de gestion") Response massUpdateUnitsRules(MassUpdateUnitRuleRequest massUpdateUnitRuleRequest); @Path("/units/computedInheritedRules") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "computeInheritedRules:action", description = "Lancer le processus de calcul des règles hérité pour la recherche") Response startComputeInheritedRules(@Dsl(value = DslSchema.BATCH_PROCESSING) JsonNode dslQuery); @Path("/units/computedInheritedRules") @DELETE @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "computeInheritedRules:delete", description = "Lancer le processus de Suppression calcul des règles hérité pour la recherche") Response deleteComputeInheritedRules(@Dsl(value = DslSchema.BATCH_PROCESSING) JsonNode dslQuery); @GET @Path("/unitsWithInheritedRules") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "unitsWithInheritedRules:read", description = "Récupérer la liste des unités archivistiques avec leurs règles de gestion héritées") Response selectUnitsWithInheritedRules(@Dsl(value = DslSchema.SELECT_MULTIPLE) JsonNode queryJson); @GET @Path("/objects") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "objects:read", description = "Récupérer la liste des groupes d'objets") Response getObjects(@Dsl(value = DslSchema.SELECT_MULTIPLE) JsonNode queryJson); @Path("/storageaccesslog") @GET @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_OCTET_STREAM) @Secured(permission = "storageaccesslog:read:binary", description = "Télécharger les journaux d'accès") Response getAccessLog(JsonNode params); @Path("/preservation") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "preservation:update", description = "Lancer le processus de préservation") Response startPreservation(PreservationRequest preservationRequest); }
AccessExternalResource extends ApplicationStatusResource { @Path("/") @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Unsecured() public Response listResourceEndpoints() { String resourcePath = AccessExternalResource.class.getAnnotation(Path.class).value(); List<EndpointInfo> securedEndpointList = this.secureEndpointRegistry.getEndPointsByResourcePath(resourcePath); return Response.status(Status.OK).entity(securedEndpointList).build(); } AccessExternalResource(SecureEndpointRegistry secureEndpointRegistry); @VisibleForTesting  AccessExternalResource(SecureEndpointRegistry secureEndpointRegistry,
        AccessInternalClientFactory accessInternalClientFactory); @Path("/") @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Unsecured() Response listResourceEndpoints(); @GET @Path("/units") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "units:read", description = "Récupérer la liste des unités archivistiques") Response getUnits(@Dsl(value = DslSchema.SELECT_MULTIPLE) JsonNode queryJson); @POST @Path("/dipexport") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "dipexport:create", description = "Générer le DIP à partir d'un DSL") Response exportDIP(@Dsl(value = DslSchema.SELECT_MULTIPLE) JsonNode queryJson); @POST @Path("/transfers") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "transfers:create", description = "Générer le SIP pour transfer à partir d'un DSL") Response transfer(TransferRequest transferRequest); @POST @Path("/transfers/reply") @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "transfers:reply", description = "Start transfer reply workflow.") Response transferReply(InputStream transferReply); @GET @Path("/transfers/{id}/sip") @Produces(MediaType.APPLICATION_OCTET_STREAM) @Secured(permission = "transfers:id:sip:read", description = "Récupérer le SIP du transfer") Response findTransferByID(@PathParam("id") String id); @POST @Path("/reclassification") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "reclassification:update", description = "Mise à jour d'arborescence des unités archivistiques") Response reclassification(@Dsl(DslSchema.RECLASSIFICATION_QUERY) JsonNode queryJson); @POST @Path("/elimination/analysis") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "elimination:analysis", description = "Analyse de l'élimination d'unités archivistiques") Response startEliminationAnalysis(EliminationRequestBody eliminationRequestBody); @POST @Path("/elimination/action") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "elimination:action", description = "Elimination définitive d'unités archivistiques") Response startEliminationAction(EliminationRequestBody eliminationRequestBody); @GET @Path("/dipexport/{id}/dip") @Produces(MediaType.APPLICATION_OCTET_STREAM) @Secured(permission = "dipexport:id:dip:read", description = "Récupérer le DIP") Response findExportByID(@PathParam("id") String id); @GET @Path("/units/{idu}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "units:id:read:json", description = "Obtenir le détail d'une unité archivistique au format json") Response getUnitById(@Dsl(value = DslSchema.GET_BY_ID) JsonNode queryJson, @PathParam("idu") String idUnit); @PUT @Path("/units/{idu}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "units:id:update", description = "Réaliser la mise à jour d'une unité archivistique") Response updateUnitById(@Dsl(DslSchema.UPDATE_BY_ID) JsonNode queryJson, @PathParam("idu") String idUnit); @GET @Path("/units/{idu}/objects") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "units:id:objects:read:json", description = "Télécharger le groupe d'objet technique de l'unité archivistique donnée") Response getObjectGroupMetadataByUnitId(@Context HttpHeaders headers, @PathParam("idu") String unitId,
        @Dsl(value = DslSchema.GET_BY_ID) JsonNode queryJson); @GET @Path("/units/{idu}/objects") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_OCTET_STREAM) @Secured(permission = "units:id:objects:read:binary", description = "Télecharger un objet") Response getDataObjectByUnitId(@Context HttpHeaders headers, @PathParam("idu") String unitId); @POST @Path("/units") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "units:update", description = "Mise à jour en masse des unités archivistiques") Response massUpdateUnits(@Dsl(DslSchema.MASS_UPDATE) JsonNode queryJson); @POST @Path("/units/rules") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "units:rules:update", description = "Mise à jour en masse des règles de gestion") Response massUpdateUnitsRules(MassUpdateUnitRuleRequest massUpdateUnitRuleRequest); @Path("/units/computedInheritedRules") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "computeInheritedRules:action", description = "Lancer le processus de calcul des règles hérité pour la recherche") Response startComputeInheritedRules(@Dsl(value = DslSchema.BATCH_PROCESSING) JsonNode dslQuery); @Path("/units/computedInheritedRules") @DELETE @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "computeInheritedRules:delete", description = "Lancer le processus de Suppression calcul des règles hérité pour la recherche") Response deleteComputeInheritedRules(@Dsl(value = DslSchema.BATCH_PROCESSING) JsonNode dslQuery); @GET @Path("/unitsWithInheritedRules") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "unitsWithInheritedRules:read", description = "Récupérer la liste des unités archivistiques avec leurs règles de gestion héritées") Response selectUnitsWithInheritedRules(@Dsl(value = DslSchema.SELECT_MULTIPLE) JsonNode queryJson); @GET @Path("/objects") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "objects:read", description = "Récupérer la liste des groupes d'objets") Response getObjects(@Dsl(value = DslSchema.SELECT_MULTIPLE) JsonNode queryJson); @Path("/storageaccesslog") @GET @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_OCTET_STREAM) @Secured(permission = "storageaccesslog:read:binary", description = "Télécharger les journaux d'accès") Response getAccessLog(JsonNode params); @Path("/preservation") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Secured(permission = "preservation:update", description = "Lancer le processus de préservation") Response startPreservation(PreservationRequest preservationRequest);  }