Search in sources :

Example 1 with AllDataAccessResource

use of org.zalando.nakadi.domain.AllDataAccessResource in project nakadi by zalando.

the class AdminService method hasAllDataAccess.

public boolean hasAllDataAccess(final AuthorizationService.Operation operation) {
    try {
        final List<Permission> permissions = resourceCache.get(ALL_DATA_ACCESS_RESOURCE, () -> authorizationDbRepository.listAllDataAccess());
        final Resource resource = new AllDataAccessResource(ALL_DATA_ACCESS_RESOURCE, ResourceAuthorization.fromPermissionsList(permissions));
        return authorizationService.isAuthorized(operation, resource);
    } catch (ExecutionException e) {
        LOG.error("Could not determine whether this application has all data access", e);
        return false;
    }
}
Also used : Permission(org.zalando.nakadi.domain.Permission) AllDataAccessResource(org.zalando.nakadi.domain.AllDataAccessResource) Resource(org.zalando.nakadi.plugin.api.authz.Resource) AdminResource(org.zalando.nakadi.domain.AdminResource) ExecutionException(java.util.concurrent.ExecutionException) AllDataAccessResource(org.zalando.nakadi.domain.AllDataAccessResource)

Aggregations

ExecutionException (java.util.concurrent.ExecutionException)1 AdminResource (org.zalando.nakadi.domain.AdminResource)1 AllDataAccessResource (org.zalando.nakadi.domain.AllDataAccessResource)1 Permission (org.zalando.nakadi.domain.Permission)1 Resource (org.zalando.nakadi.plugin.api.authz.Resource)1