Search in sources :

Example 1 with TestingPrivilege

use of io.trino.testing.TestingAccessControlManager.TestingPrivilege in project trino by trinodb.

the class TestAccessControl method testFunctionAccessControl.

@Test
public void testFunctionAccessControl() {
    assertAccessDenied("SELECT reverse('a')", "Cannot execute function reverse", new TestingPrivilege(Optional.empty(), "reverse", EXECUTE_FUNCTION));
    TestingPrivilege denyNonReverseFunctionCalls = new TestingPrivilege(Optional.empty(), name -> !name.equals("reverse"), EXECUTE_FUNCTION);
    assertAccessAllowed("SELECT reverse('a')", denyNonReverseFunctionCalls);
    assertAccessDenied("SELECT concat('a', 'b')", "Cannot execute function concat", denyNonReverseFunctionCalls);
}
Also used : TestingPrivilege(io.trino.testing.TestingAccessControlManager.TestingPrivilege) Test(org.testng.annotations.Test)

Aggregations

TestingPrivilege (io.trino.testing.TestingAccessControlManager.TestingPrivilege)1 Test (org.testng.annotations.Test)1