Search in sources :

Example 11 with DatasetId

use of com.bakdata.conquery.models.identifiable.ids.specific.DatasetId in project conquery by bakdata.

the class InstancePermissionImplificationTest method testDivergingAccesTypes.

@Test
public void testDivergingAccesTypes() {
    // Test different access types
    Permission pStored = DatasetPermission.onInstance(Ability.READ.asSet(), new DatasetId(DATASET1));
    Permission pRequested = DatasetPermission.onInstance(Ability.DOWNLOAD.asSet(), new DatasetId(DATASET1));
    assert !pStored.implies(pRequested);
}
Also used : SuperPermission(com.bakdata.conquery.models.auth.permissions.SuperPermission) DatasetPermission(com.bakdata.conquery.models.auth.permissions.DatasetPermission) ExecutionPermission(com.bakdata.conquery.models.auth.permissions.ExecutionPermission) Permission(org.apache.shiro.authz.Permission) AdminPermission(com.bakdata.conquery.models.auth.permissions.AdminPermission) DatasetId(com.bakdata.conquery.models.identifiable.ids.specific.DatasetId) Test(org.junit.jupiter.api.Test)

Example 12 with DatasetId

use of com.bakdata.conquery.models.identifiable.ids.specific.DatasetId in project conquery by bakdata.

the class InstancePermissionImplificationTest method testDivergingInstances.

@Test
public void testDivergingInstances() {
    // Test different Instances
    Permission pStored = DatasetPermission.onInstance(Ability.READ.asSet(), new DatasetId(DATASET1));
    Permission pRequested = DatasetPermission.onInstance(Ability.READ.asSet(), new DatasetId(DATASET2));
    assert !pStored.implies(pRequested);
}
Also used : SuperPermission(com.bakdata.conquery.models.auth.permissions.SuperPermission) DatasetPermission(com.bakdata.conquery.models.auth.permissions.DatasetPermission) ExecutionPermission(com.bakdata.conquery.models.auth.permissions.ExecutionPermission) Permission(org.apache.shiro.authz.Permission) AdminPermission(com.bakdata.conquery.models.auth.permissions.AdminPermission) DatasetId(com.bakdata.conquery.models.identifiable.ids.specific.DatasetId) Test(org.junit.jupiter.api.Test)

Example 13 with DatasetId

use of com.bakdata.conquery.models.identifiable.ids.specific.DatasetId in project conquery by bakdata.

the class InstancePermissionImplificationTest method permissionTypesFail.

@Test
public void permissionTypesFail() {
    Permission dPerm = DatasetPermission.onInstance(Ability.READ.asSet(), new DatasetId(DATASET1));
    Permission qPerm = ExecutionPermission.onInstance(Ability.READ.asSet(), new ManagedExecutionId(new DatasetId(DATASET1), UUID.randomUUID()));
    Permission sPerm = SuperPermission.onDomain();
    Permission aPerm = AdminPermission.onDomain();
    assertThat(dPerm.implies(qPerm)).isFalse();
    assertThat(dPerm.implies(sPerm)).isFalse();
    assertThat(aPerm.implies(sPerm)).isFalse();
}
Also used : SuperPermission(com.bakdata.conquery.models.auth.permissions.SuperPermission) DatasetPermission(com.bakdata.conquery.models.auth.permissions.DatasetPermission) ExecutionPermission(com.bakdata.conquery.models.auth.permissions.ExecutionPermission) Permission(org.apache.shiro.authz.Permission) AdminPermission(com.bakdata.conquery.models.auth.permissions.AdminPermission) ManagedExecutionId(com.bakdata.conquery.models.identifiable.ids.specific.ManagedExecutionId) DatasetId(com.bakdata.conquery.models.identifiable.ids.specific.DatasetId) Test(org.junit.jupiter.api.Test)

Example 14 with DatasetId

use of com.bakdata.conquery.models.identifiable.ids.specific.DatasetId in project conquery by bakdata.

the class InstancePermissionImplificationTest method testMultipleAccessesProhibit.

@Test
public void testMultipleAccessesProhibit() {
    // Test different Instances
    Permission pStored = DatasetPermission.onInstance(Ability.READ.asSet(), new DatasetId(DATASET1));
    Permission pRequested = DatasetPermission.onInstance(EnumSet.of(Ability.READ, Ability.DOWNLOAD), new DatasetId(DATASET1));
    // Should not imply, since one access is missing
    assert !pStored.implies(pRequested);
}
Also used : SuperPermission(com.bakdata.conquery.models.auth.permissions.SuperPermission) DatasetPermission(com.bakdata.conquery.models.auth.permissions.DatasetPermission) ExecutionPermission(com.bakdata.conquery.models.auth.permissions.ExecutionPermission) Permission(org.apache.shiro.authz.Permission) AdminPermission(com.bakdata.conquery.models.auth.permissions.AdminPermission) DatasetId(com.bakdata.conquery.models.identifiable.ids.specific.DatasetId) Test(org.junit.jupiter.api.Test)

Example 15 with DatasetId

use of com.bakdata.conquery.models.identifiable.ids.specific.DatasetId in project conquery by bakdata.

the class InstancePermissionImplificationTest method testEqual.

@Test
public void testEqual() {
    // Test equal Permissions
    Permission pStored = DatasetPermission.onInstance(Ability.READ.asSet(), new DatasetId(DATASET1));
    Permission pRequested = DatasetPermission.onInstance(Ability.READ.asSet(), new DatasetId(DATASET1));
    assert pStored.implies(pRequested);
}
Also used : SuperPermission(com.bakdata.conquery.models.auth.permissions.SuperPermission) DatasetPermission(com.bakdata.conquery.models.auth.permissions.DatasetPermission) ExecutionPermission(com.bakdata.conquery.models.auth.permissions.ExecutionPermission) Permission(org.apache.shiro.authz.Permission) AdminPermission(com.bakdata.conquery.models.auth.permissions.AdminPermission) DatasetId(com.bakdata.conquery.models.identifiable.ids.specific.DatasetId) Test(org.junit.jupiter.api.Test)

Aggregations

DatasetId (com.bakdata.conquery.models.identifiable.ids.specific.DatasetId)31 Test (org.junit.jupiter.api.Test)18 DatasetPermission (com.bakdata.conquery.models.auth.permissions.DatasetPermission)9 Permission (org.apache.shiro.authz.Permission)8 User (com.bakdata.conquery.models.auth.entities.User)7 AdminPermission (com.bakdata.conquery.models.auth.permissions.AdminPermission)7 ExecutionPermission (com.bakdata.conquery.models.auth.permissions.ExecutionPermission)7 SuperPermission (com.bakdata.conquery.models.auth.permissions.SuperPermission)7 ConqueryTestSpec (com.bakdata.conquery.integration.json.ConqueryTestSpec)6 Role (com.bakdata.conquery.models.auth.entities.Role)6 MetaStorage (com.bakdata.conquery.io.storage.MetaStorage)5 Dataset (com.bakdata.conquery.models.datasets.Dataset)5 Group (com.bakdata.conquery.models.auth.entities.Group)4 ConceptId (com.bakdata.conquery.models.identifiable.ids.specific.ConceptId)4 ConceptTreeChildId (com.bakdata.conquery.models.identifiable.ids.specific.ConceptTreeChildId)4 DatasetRegistry (com.bakdata.conquery.models.worker.DatasetRegistry)4 ConceptsProcessor (com.bakdata.conquery.resources.api.ConceptsProcessor)4 ResolvedConceptsResult (com.bakdata.conquery.resources.api.ConceptsProcessor.ResolvedConceptsResult)4 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)4 FilterTemplate (com.bakdata.conquery.apiv1.FilterTemplate)3