use of io.prestosql.spi.security.AccessDeniedException in project ranger by apache.
the class RangerSystemAccessControlTest method testViewOperations.
@Test
@SuppressWarnings("PMD")
public void testViewOperations() {
accessControlManager.checkCanCreateView(context(alice), aliceView);
accessControlManager.checkCanDropView(context(alice), aliceView);
accessControlManager.checkCanSelectFromColumns(context(alice), aliceView, ImmutableSet.of());
accessControlManager.checkCanCreateViewWithSelectFromColumns(context(alice), aliceTable, ImmutableSet.of());
accessControlManager.checkCanCreateViewWithSelectFromColumns(context(alice), aliceView, ImmutableSet.of());
accessControlManager.checkCanSetCatalogSessionProperty(context(alice), aliceCatalog, "property");
accessControlManager.checkCanGrantTablePrivilege(context(alice), SELECT, aliceTable, new PrestoPrincipal(USER, "grantee"), true);
accessControlManager.checkCanRevokeTablePrivilege(context(alice), SELECT, aliceTable, new PrestoPrincipal(USER, "revokee"), true);
try {
accessControlManager.checkCanCreateView(context(bob), aliceView);
} catch (AccessDeniedException expected) {
}
}
use of io.prestosql.spi.security.AccessDeniedException in project ranger by apache.
the class RangerSystemAccessControlTest method testSchemaOperations.
@Test
@SuppressWarnings("PMD")
public void testSchemaOperations() {
Set<String> aliceSchemas = ImmutableSet.of("schema");
assertEquals(accessControlManager.filterSchemas(context(alice), aliceCatalog, aliceSchemas), aliceSchemas);
assertEquals(accessControlManager.filterSchemas(context(bob), "alice-catalog", aliceSchemas), ImmutableSet.of());
accessControlManager.checkCanCreateSchema(context(alice), aliceSchema);
accessControlManager.checkCanDropSchema(context(alice), aliceSchema);
accessControlManager.checkCanRenameSchema(context(alice), aliceSchema, "new-schema");
accessControlManager.checkCanShowSchemas(context(alice), aliceCatalog);
try {
accessControlManager.checkCanCreateSchema(context(bob), aliceSchema);
} catch (AccessDeniedException expected) {
}
accessControlManager.checkCanSetSchemaAuthorization(context(alice), aliceSchema, new PrestoPrincipal(USER, "principal"));
accessControlManager.checkCanShowCreateSchema(context(alice), aliceSchema);
}
use of io.prestosql.spi.security.AccessDeniedException in project ranger by apache.
the class RangerSystemAccessControlTest method testTableOperations.
@Test
@SuppressWarnings("PMD")
public void testTableOperations() {
Set<SchemaTableName> aliceTables = ImmutableSet.of(new SchemaTableName("schema", "table"));
assertEquals(accessControlManager.filterTables(context(alice), aliceCatalog, aliceTables), aliceTables);
assertEquals(accessControlManager.filterTables(context(bob), "alice-catalog", aliceTables), ImmutableSet.of());
accessControlManager.checkCanCreateTable(context(alice), aliceTable);
accessControlManager.checkCanDropTable(context(alice), aliceTable);
accessControlManager.checkCanSelectFromColumns(context(alice), aliceTable, ImmutableSet.of());
accessControlManager.checkCanInsertIntoTable(context(alice), aliceTable);
accessControlManager.checkCanDeleteFromTable(context(alice), aliceTable);
accessControlManager.checkCanRenameColumn(context(alice), aliceTable);
try {
accessControlManager.checkCanCreateTable(context(bob), aliceTable);
} catch (AccessDeniedException expected) {
}
}
Aggregations