Search in sources :

Example 1 with DocumentPoolModule

use of org.olat.modules.docpool.DocumentPoolModule in project OpenOLAT by OpenOLAT.

the class DocumentPoolModuleWebService method getModuleConfiguration.

/**
 * Return the configuration of the taxonomy module.
 *
 * @response.representation.200.qname {http://www.example.com}taxonomyModuleConfigurationVO
 * @response.representation.200.mediaType application/xml, application/json
 * @response.representation.200.doc The configuration of the taxonomy module
 * @response.representation.200.example {@link org.olat.modules.docpool.restapi.Examples#SAMPLE_DOCUMENTPOOLMODULECONFIGURATIONVO}
 * @response.representation.401.doc The roles of the authenticated user are not sufficient
 * @param httpRequest  The HTTP request
 * @return The module configuration
 */
@GET
@Path("module/configuration")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getModuleConfiguration(@Context HttpServletRequest httpRequest) {
    Roles roles = getRoles(httpRequest);
    if (!roles.isOLATAdmin()) {
        return Response.serverError().status(Status.UNAUTHORIZED).build();
    }
    DocumentPoolModule taxonomyModule = CoreSpringFactory.getImpl(DocumentPoolModule.class);
    DocumentPoolModuleConfigurationVO configVO = new DocumentPoolModuleConfigurationVO();
    configVO.setEnabled(taxonomyModule.isEnabled());
    configVO.setTaxonomyTreeKey(taxonomyModule.getTaxonomyTreeKey());
    return Response.ok(configVO).build();
}
Also used : DocumentPoolModule(org.olat.modules.docpool.DocumentPoolModule) RestSecurityHelper.getRoles(org.olat.restapi.security.RestSecurityHelper.getRoles) Roles(org.olat.core.id.Roles) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 2 with DocumentPoolModule

use of org.olat.modules.docpool.DocumentPoolModule in project openolat by klemens.

the class DocumentPoolModuleWebService method getModuleConfiguration.

/**
 * Return the configuration of the taxonomy module.
 *
 * @response.representation.200.qname {http://www.example.com}taxonomyModuleConfigurationVO
 * @response.representation.200.mediaType application/xml, application/json
 * @response.representation.200.doc The configuration of the taxonomy module
 * @response.representation.200.example {@link org.olat.modules.docpool.restapi.Examples#SAMPLE_DOCUMENTPOOLMODULECONFIGURATIONVO}
 * @response.representation.401.doc The roles of the authenticated user are not sufficient
 * @param httpRequest  The HTTP request
 * @return The module configuration
 */
@GET
@Path("module/configuration")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getModuleConfiguration(@Context HttpServletRequest httpRequest) {
    Roles roles = getRoles(httpRequest);
    if (!roles.isOLATAdmin()) {
        return Response.serverError().status(Status.UNAUTHORIZED).build();
    }
    DocumentPoolModule taxonomyModule = CoreSpringFactory.getImpl(DocumentPoolModule.class);
    DocumentPoolModuleConfigurationVO configVO = new DocumentPoolModuleConfigurationVO();
    configVO.setEnabled(taxonomyModule.isEnabled());
    configVO.setTaxonomyTreeKey(taxonomyModule.getTaxonomyTreeKey());
    return Response.ok(configVO).build();
}
Also used : DocumentPoolModule(org.olat.modules.docpool.DocumentPoolModule) RestSecurityHelper.getRoles(org.olat.restapi.security.RestSecurityHelper.getRoles) Roles(org.olat.core.id.Roles) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 Roles (org.olat.core.id.Roles)2 DocumentPoolModule (org.olat.modules.docpool.DocumentPoolModule)2 RestSecurityHelper.getRoles (org.olat.restapi.security.RestSecurityHelper.getRoles)2