Search in sources :

Example 1 with ResourcePermissionInformation

use of io.crnk.security.ResourcePermissionInformation in project crnk-framework by crnk-project.

the class SecurityRepositoryFilter method filterMeta.

@Override
public <T> MetaInformation filterMeta(RepositoryFilterContext context, Iterable<T> resources, RepositoryMetaFilterChain chain) {
    MetaInformation metaInformation = chain.doFilter(context, resources);
    if (metaInformation instanceof ResourcePermissionInformation) {
        ResourcePermissionInformation permissionInformation = (ResourcePermissionInformation) metaInformation;
        QueryAdapter queryAdapter = context.getRequest().getQueryAdapter();
        Class<?> resourceClass = queryAdapter.getResourceInformation().getResourceClass();
        permissionInformation.setResourcePermission(module.getResourcePermission(resourceClass));
    }
    return metaInformation;
}
Also used : ResourcePermissionInformation(io.crnk.security.ResourcePermissionInformation) QueryAdapter(io.crnk.core.engine.query.QueryAdapter) MetaInformation(io.crnk.core.resource.meta.MetaInformation)

Aggregations

QueryAdapter (io.crnk.core.engine.query.QueryAdapter)1 MetaInformation (io.crnk.core.resource.meta.MetaInformation)1 ResourcePermissionInformation (io.crnk.security.ResourcePermissionInformation)1