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);
}
Aggregations