Search in sources :

Example 1 with NoAccessPredicate

use of uk.gov.gchq.gaffer.access.predicate.NoAccessPredicate in project Gaffer by gchq.

the class FederatedGraphStorageTest method setUp.

@BeforeEach
public void setUp() throws Exception {
    graphStorage = new FederatedGraphStorage();
    e1 = new SchemaEntityDefinition.Builder().vertex("string").build();
    a = new GraphSerialisable.Builder().config(new GraphConfig(GRAPH_ID_A)).properties(PROPERTIES).schema(new Schema.Builder().entity("e1", e1).type("string", String.class).build()).build();
    e2 = new SchemaEntityDefinition.Builder().vertex("string2").build();
    b = new GraphSerialisable.Builder().config(new GraphConfig(GRAPH_ID_B)).properties(PROPERTIES).schema(new Schema.Builder().entity("e2", e2).type("string2", String.class).build()).build();
    nullUser = null;
    testUser = testUser();
    authUser = authUser();
    blankUser = blankUser();
    testUserContext = new Context(testUser);
    authUserContext = new Context(authUser);
    blankUserContext = new Context(blankUser);
    access = new FederatedAccess(Sets.newHashSet(AUTH_1), TEST_USER_ID);
    altAccess = new FederatedAccess(Sets.newHashSet(AUTH_2), TEST_USER_ID);
    disabledByDefaultAccess = new FederatedAccess(Sets.newHashSet(AUTH_1), TEST_USER_ID, false, true);
    blockingAccessPredicate = new NoAccessPredicate();
    blockingReadAccess = new FederatedAccess(NULL_GRAPH_AUTHS, TEST_USER_ID, false, false, blockingAccessPredicate, null);
    blockingWriteAccess = new FederatedAccess(NULL_GRAPH_AUTHS, TEST_USER_ID, false, false, null, blockingAccessPredicate);
    permissiveAccessPredicate = new UnrestrictedAccessPredicate();
    permissiveReadAccess = new FederatedAccess(NULL_GRAPH_AUTHS, TEST_USER_ID, false, false, permissiveAccessPredicate, null);
    permissiveWriteAccess = new FederatedAccess(NULL_GRAPH_AUTHS, TEST_USER_ID, false, false, null, permissiveAccessPredicate);
}
Also used : GraphConfig(uk.gov.gchq.gaffer.graph.GraphConfig) Context(uk.gov.gchq.gaffer.store.Context) NoAccessPredicate(uk.gov.gchq.gaffer.access.predicate.NoAccessPredicate) GraphSerialisable(uk.gov.gchq.gaffer.graph.GraphSerialisable) UnrestrictedAccessPredicate(uk.gov.gchq.gaffer.access.predicate.UnrestrictedAccessPredicate) SchemaEntityDefinition(uk.gov.gchq.gaffer.store.schema.SchemaEntityDefinition) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with NoAccessPredicate

use of uk.gov.gchq.gaffer.access.predicate.NoAccessPredicate in project Gaffer by gchq.

the class FederatedGraphStorageTraitsTest method setUp.

@BeforeEach
public void setUp() throws Exception {
    graphStorage = new FederatedGraphStorage();
    acc = new GraphSerialisable.Builder().config(new GraphConfig(GRAPH_ID_ACCUMULO)).properties(ACCUMULO_PROPERTIES).schema(new Schema.Builder().entity("entities", new SchemaEntityDefinition.Builder().vertex("string").build()).type("string", String.class).build()).build();
    map = new GraphSerialisable.Builder().config(new GraphConfig(GRAPH_ID_MAP)).properties(MAP_PROPERTIES).schema(new Schema.Builder().edge("edges", new SchemaEdgeDefinition.Builder().source("string").destination("string").build()).type("string", String.class).build()).build();
    nullUser = nullUser();
    testUser = testUser();
    authUser = authUser();
    blankUser = blankUser();
    testUserContext = new Context(testUser);
    authUserContext = new Context(authUser);
    blankUserContext = new Context(blankUser);
    blockingAccessPredicate = new NoAccessPredicate();
    permissiveAccessPredicate = new UnrestrictedAccessPredicate();
    getTraits = new GetTraits();
}
Also used : GraphConfig(uk.gov.gchq.gaffer.graph.GraphConfig) Context(uk.gov.gchq.gaffer.store.Context) NoAccessPredicate(uk.gov.gchq.gaffer.access.predicate.NoAccessPredicate) GraphSerialisable(uk.gov.gchq.gaffer.graph.GraphSerialisable) GetTraits(uk.gov.gchq.gaffer.store.operation.GetTraits) UnrestrictedAccessPredicate(uk.gov.gchq.gaffer.access.predicate.UnrestrictedAccessPredicate) SchemaEdgeDefinition(uk.gov.gchq.gaffer.store.schema.SchemaEdgeDefinition) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with NoAccessPredicate

use of uk.gov.gchq.gaffer.access.predicate.NoAccessPredicate in project Gaffer by gchq.

the class FederatedStoreGetTraitsTest method setUp.

@Before
public void setUp() throws Exception {
    federatedStore = new FederatedStore();
    federatedStore.initialise("testFed", new Schema(), new FederatedStoreProperties());
    acc = new GraphSerialisable.Builder().config(new GraphConfig(GRAPH_ID_ACCUMULO)).properties(ACCUMULO_PROPERTIES).schema(new Schema.Builder().entity("entities", new SchemaEntityDefinition.Builder().vertex("string").build()).type("string", String.class).build()).build();
    map = new GraphSerialisable.Builder().config(new GraphConfig(GRAPH_ID_MAP)).properties(MAP_PROPERTIES).schema(new Schema.Builder().edge("edges", new SchemaEdgeDefinition.Builder().source("string").destination("string").build()).type("string", String.class).build()).build();
    nullUser = nullUser();
    testUser = testUser();
    authUser = authUser();
    blankUser = blankUser();
    testUserContext = new Context(testUser);
    authUserContext = new Context(authUser);
    blankUserContext = new Context(blankUser);
    blockingAccessPredicate = new NoAccessPredicate();
    permissiveAccessPredicate = new UnrestrictedAccessPredicate();
    getTraits = new GetTraits();
}
Also used : Context(uk.gov.gchq.gaffer.store.Context) NoAccessPredicate(uk.gov.gchq.gaffer.access.predicate.NoAccessPredicate) Schema(uk.gov.gchq.gaffer.store.schema.Schema) UnrestrictedAccessPredicate(uk.gov.gchq.gaffer.access.predicate.UnrestrictedAccessPredicate) GraphConfig(uk.gov.gchq.gaffer.graph.GraphConfig) GraphSerialisable(uk.gov.gchq.gaffer.graph.GraphSerialisable) GetTraits(uk.gov.gchq.gaffer.store.operation.GetTraits) SchemaEdgeDefinition(uk.gov.gchq.gaffer.store.schema.SchemaEdgeDefinition) Before(org.junit.Before)

Example 4 with NoAccessPredicate

use of uk.gov.gchq.gaffer.access.predicate.NoAccessPredicate in project Gaffer by gchq.

the class NamedOperationCacheTest method shouldThrowExceptionTryingToDeleteOperationConfiguredWithWriteNoAccessPredicate.

@Test
public void shouldThrowExceptionTryingToDeleteOperationConfiguredWithWriteNoAccessPredicate() throws CacheOperationFailedException {
    final NamedOperationDetail noWriteAccess = new NamedOperationDetail.Builder().creatorId(standardUser.getUserId()).description("an operation that does no allow read access").operationName("test").readers(readers).operationChain(standardOpChain).writeAccessPredicate(new NoAccessPredicate()).build();
    cache.addNamedOperation(noWriteAccess, false, standardUser);
    assertThatExceptionOfType(CacheOperationFailedException.class).isThrownBy(() -> cache.deleteNamedOperation("test", standardUser));
}
Also used : NoAccessPredicate(uk.gov.gchq.gaffer.access.predicate.NoAccessPredicate) NamedOperationDetail(uk.gov.gchq.gaffer.named.operation.NamedOperationDetail) CacheOperationFailedException(uk.gov.gchq.gaffer.named.operation.cache.exception.CacheOperationFailedException) Test(org.junit.jupiter.api.Test)

Example 5 with NoAccessPredicate

use of uk.gov.gchq.gaffer.access.predicate.NoAccessPredicate in project Gaffer by gchq.

the class NamedOperationCacheTest method shouldNotReturnNamedOperationConfiguredWithReadNoAccessPredicate.

@Test
public void shouldNotReturnNamedOperationConfiguredWithReadNoAccessPredicate() throws CacheOperationFailedException {
    final NamedOperationDetail noReadAccess = new NamedOperationDetail.Builder().creatorId(standardUser.getUserId()).description("an operation that does no allow read access").operationName("test").writers(writers).operationChain(standardOpChain).readAccessPredicate(new NoAccessPredicate()).build();
    cache.addNamedOperation(noReadAccess, false, standardUser);
    assertFalse(cache.getAllNamedOperations(standardUser).iterator().hasNext());
}
Also used : NoAccessPredicate(uk.gov.gchq.gaffer.access.predicate.NoAccessPredicate) NamedOperationDetail(uk.gov.gchq.gaffer.named.operation.NamedOperationDetail) Test(org.junit.jupiter.api.Test)

Aggregations

NoAccessPredicate (uk.gov.gchq.gaffer.access.predicate.NoAccessPredicate)6 GraphConfig (uk.gov.gchq.gaffer.graph.GraphConfig)4 GraphSerialisable (uk.gov.gchq.gaffer.graph.GraphSerialisable)4 Context (uk.gov.gchq.gaffer.store.Context)4 Test (org.junit.jupiter.api.Test)3 UnrestrictedAccessPredicate (uk.gov.gchq.gaffer.access.predicate.UnrestrictedAccessPredicate)3 BeforeEach (org.junit.jupiter.api.BeforeEach)2 NamedOperationDetail (uk.gov.gchq.gaffer.named.operation.NamedOperationDetail)2 GetTraits (uk.gov.gchq.gaffer.store.operation.GetTraits)2 Schema (uk.gov.gchq.gaffer.store.schema.Schema)2 SchemaEdgeDefinition (uk.gov.gchq.gaffer.store.schema.SchemaEdgeDefinition)2 Before (org.junit.Before)1 AccessPredicate (uk.gov.gchq.gaffer.access.predicate.AccessPredicate)1 FederatedStore (uk.gov.gchq.gaffer.federatedstore.FederatedStore)1 FederatedStoreProperties (uk.gov.gchq.gaffer.federatedstore.FederatedStoreProperties)1 RemoveGraph (uk.gov.gchq.gaffer.federatedstore.operation.RemoveGraph)1 Graph (uk.gov.gchq.gaffer.graph.Graph)1 CacheOperationFailedException (uk.gov.gchq.gaffer.named.operation.cache.exception.CacheOperationFailedException)1 SchemaEntityDefinition (uk.gov.gchq.gaffer.store.schema.SchemaEntityDefinition)1