Search in sources :

Example 1 with GraphQLControllerException

use of io.jmix.graphql.controller.GraphQLControllerException in project jmix by jmix-framework.

the class FilePermissionService method checkFileDownloadPermission.

public void checkFileDownloadPermission() {
    GraphQLAccessContext downloadContext = new GraphQLAccessContext(GraphQLAccessContext.GRAPHQL_FILE_DOWNLOAD_ENABLED);
    accessManager.applyRegisteredConstraints(downloadContext);
    if (!downloadContext.isPermitted()) {
        throw new GraphQLControllerException("File download failed", "File download is not permitted", HttpStatus.FORBIDDEN);
    }
}
Also used : GraphQLAccessContext(io.jmix.graphql.accesscontext.GraphQLAccessContext) GraphQLControllerException(io.jmix.graphql.controller.GraphQLControllerException)

Aggregations

GraphQLAccessContext (io.jmix.graphql.accesscontext.GraphQLAccessContext)1 GraphQLControllerException (io.jmix.graphql.controller.GraphQLControllerException)1