Search in sources :

Example 6 with Resource

use of org.zalando.nakadi.plugin.api.authz.Resource 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

Resource (org.zalando.nakadi.plugin.api.authz.Resource)6 AccessDeniedException (org.zalando.nakadi.exceptions.runtime.AccessDeniedException)4 EventType (org.zalando.nakadi.domain.EventType)3 EventTypeResource (org.zalando.nakadi.domain.EventTypeResource)3 Test (org.junit.Test)2 AdminResource (org.zalando.nakadi.domain.AdminResource)2 AllDataAccessResource (org.zalando.nakadi.domain.AllDataAccessResource)2 Permission (org.zalando.nakadi.domain.Permission)2 Date (java.util.Date)1 ExecutionException (java.util.concurrent.ExecutionException)1 DefaultStorage (org.zalando.nakadi.domain.DefaultStorage)1 PartitionStatistics (org.zalando.nakadi.domain.PartitionStatistics)1 Storage (org.zalando.nakadi.domain.Storage)1 Timeline (org.zalando.nakadi.domain.Timeline)1 InternalNakadiException (org.zalando.nakadi.exceptions.InternalNakadiException)1 NoSuchEventTypeException (org.zalando.nakadi.exceptions.NoSuchEventTypeException)1 NotFoundException (org.zalando.nakadi.exceptions.NotFoundException)1 ServiceUnavailableException (org.zalando.nakadi.exceptions.ServiceUnavailableException)1 TimelineException (org.zalando.nakadi.exceptions.TimelineException)1 TopicCreationException (org.zalando.nakadi.exceptions.TopicCreationException)1