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);
}
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();
}
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();
}
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));
}
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());
}
Aggregations