Search in sources :

Example 1 with UnrestrictedAccessPredicate

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

the class NamedViewDetailTest method shouldConfigureUnrestrictedAccessPredicateForReadAccessTestByDefault.

@Test
public void shouldConfigureUnrestrictedAccessPredicateForReadAccessTestByDefault() {
    final NamedViewDetail namedViewDetail = createNamedViewDetailBuilder().build();
    assertEquals(new UnrestrictedAccessPredicate(), namedViewDetail.getOrDefaultReadAccessPredicate());
}
Also used : UnrestrictedAccessPredicate(uk.gov.gchq.gaffer.access.predicate.UnrestrictedAccessPredicate) Test(org.junit.jupiter.api.Test)

Example 2 with UnrestrictedAccessPredicate

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

the class AddNamedViewHandlerTest method shouldAddNamedViewCorrectly.

@Test
public void shouldAddNamedViewCorrectly() throws OperationException, CacheOperationFailedException {
    handler.doOperation(addNamedView, context, store);
    final NamedViewDetail result = namedViewCache.getNamedView(testNamedViewName);
    assertTrue(cacheContains(testNamedViewName));
    assertEquals(addNamedView.getName(), result.getName());
    assertEquals(new String(addNamedView.getView().toCompactJson()), result.getView());
    assertEquals(context.getUser().getUserId(), result.getCreatorId());
    assertEquals(new UnrestrictedAccessPredicate(), result.getOrDefaultReadAccessPredicate());
    final AccessPredicate expectedWriteAccessPredicate = new NamedViewWriteAccessPredicate(context.getUser(), Arrays.asList(writeAccessRoles));
    assertEquals(expectedWriteAccessPredicate, result.getOrDefaultWriteAccessPredicate());
}
Also used : UnrestrictedAccessPredicate(uk.gov.gchq.gaffer.access.predicate.UnrestrictedAccessPredicate) NamedViewWriteAccessPredicate(uk.gov.gchq.gaffer.data.elementdefinition.view.access.predicate.NamedViewWriteAccessPredicate) AccessPredicate(uk.gov.gchq.gaffer.access.predicate.AccessPredicate) UnrestrictedAccessPredicate(uk.gov.gchq.gaffer.access.predicate.UnrestrictedAccessPredicate) NamedViewDetail(uk.gov.gchq.gaffer.data.elementdefinition.view.NamedViewDetail) NamedViewWriteAccessPredicate(uk.gov.gchq.gaffer.data.elementdefinition.view.access.predicate.NamedViewWriteAccessPredicate) Test(org.junit.jupiter.api.Test)

Example 3 with UnrestrictedAccessPredicate

use of uk.gov.gchq.gaffer.access.predicate.UnrestrictedAccessPredicate 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 4 with UnrestrictedAccessPredicate

use of uk.gov.gchq.gaffer.access.predicate.UnrestrictedAccessPredicate 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 5 with UnrestrictedAccessPredicate

use of uk.gov.gchq.gaffer.access.predicate.UnrestrictedAccessPredicate 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)

Aggregations

UnrestrictedAccessPredicate (uk.gov.gchq.gaffer.access.predicate.UnrestrictedAccessPredicate)5 NoAccessPredicate (uk.gov.gchq.gaffer.access.predicate.NoAccessPredicate)3 GraphConfig (uk.gov.gchq.gaffer.graph.GraphConfig)3 GraphSerialisable (uk.gov.gchq.gaffer.graph.GraphSerialisable)3 Context (uk.gov.gchq.gaffer.store.Context)3 BeforeEach (org.junit.jupiter.api.BeforeEach)2 Test (org.junit.jupiter.api.Test)2 GetTraits (uk.gov.gchq.gaffer.store.operation.GetTraits)2 SchemaEdgeDefinition (uk.gov.gchq.gaffer.store.schema.SchemaEdgeDefinition)2 Before (org.junit.Before)1 AccessPredicate (uk.gov.gchq.gaffer.access.predicate.AccessPredicate)1 NamedViewDetail (uk.gov.gchq.gaffer.data.elementdefinition.view.NamedViewDetail)1 NamedViewWriteAccessPredicate (uk.gov.gchq.gaffer.data.elementdefinition.view.access.predicate.NamedViewWriteAccessPredicate)1 Schema (uk.gov.gchq.gaffer.store.schema.Schema)1 SchemaEntityDefinition (uk.gov.gchq.gaffer.store.schema.SchemaEntityDefinition)1