Search in sources :

Example 1 with AllowAllAccessControl

use of io.trino.plugin.base.security.AllowAllAccessControl in project trino by trinodb.

the class TestAccessControlManager method testAllowExecuteProcedure.

@Test
public void testAllowExecuteProcedure() {
    try (LocalQueryRunner queryRunner = LocalQueryRunner.create(TEST_SESSION)) {
        TransactionManager transactionManager = queryRunner.getTransactionManager();
        AccessControlManager accessControlManager = createAccessControlManager(transactionManager);
        accessControlManager.setSystemAccessControl("allow-all", ImmutableMap.of());
        queryRunner.createCatalog("connector", MockConnectorFactory.create(), ImmutableMap.of());
        accessControlManager.addCatalogAccessControl(new CatalogName("connector"), new AllowAllAccessControl());
        transaction(transactionManager, accessControlManager).execute(transactionId -> {
            accessControlManager.checkCanExecuteProcedure(context(transactionId), new QualifiedObjectName("connector", "schema", "procedure"));
        });
    }
}
Also used : TransactionManager(io.trino.transaction.TransactionManager) InMemoryTransactionManager.createTestTransactionManager(io.trino.transaction.InMemoryTransactionManager.createTestTransactionManager) AllowAllAccessControl(io.trino.plugin.base.security.AllowAllAccessControl) CatalogName(io.trino.connector.CatalogName) LocalQueryRunner(io.trino.testing.LocalQueryRunner) QualifiedObjectName(io.trino.metadata.QualifiedObjectName) Test(org.testng.annotations.Test)

Aggregations

CatalogName (io.trino.connector.CatalogName)1 QualifiedObjectName (io.trino.metadata.QualifiedObjectName)1 AllowAllAccessControl (io.trino.plugin.base.security.AllowAllAccessControl)1 LocalQueryRunner (io.trino.testing.LocalQueryRunner)1 InMemoryTransactionManager.createTestTransactionManager (io.trino.transaction.InMemoryTransactionManager.createTestTransactionManager)1 TransactionManager (io.trino.transaction.TransactionManager)1 Test (org.testng.annotations.Test)1