Search in sources :

Example 1 with VarcharType

use of io.prestosql.spi.type.VarcharType in project ranger by apache.

the class RangerSystemAccessControlTest method testMisc.

@Test
@SuppressWarnings("PMD")
public void testMisc() {
    assertEquals(accessControlManager.filterViewQueryOwnedBy(context(alice), queryOwners), queryOwners);
    // check {type} / {col} replacement
    final VarcharType varcharType = VarcharType.createVarcharType(20);
    Optional<ViewExpression> ret = accessControlManager.getColumnMask(context(alice), aliceTable, "cast_me", varcharType);
    assertNotNull(ret.get());
    assertEquals(ret.get().getExpression(), "cast cast_me as varchar(20)");
    ret = accessControlManager.getColumnMask(context(alice), aliceTable, "do-not-cast-me", varcharType);
    assertFalse(ret.isPresent());
    ret = accessControlManager.getRowFilter(context(alice), aliceTable);
    assertFalse(ret.isPresent());
    accessControlManager.checkCanExecuteFunction(context(alice), functionName);
    accessControlManager.checkCanGrantExecuteFunctionPrivilege(context(alice), functionName, new PrestoPrincipal(USER, "grantee"), true);
    accessControlManager.checkCanExecuteProcedure(context(alice), aliceProcedure);
}
Also used : VarcharType(io.prestosql.spi.type.VarcharType) PrestoPrincipal(io.prestosql.spi.security.PrestoPrincipal) ViewExpression(io.prestosql.spi.security.ViewExpression) Test(org.junit.Test)

Aggregations

PrestoPrincipal (io.prestosql.spi.security.PrestoPrincipal)1 ViewExpression (io.prestosql.spi.security.ViewExpression)1 VarcharType (io.prestosql.spi.type.VarcharType)1 Test (org.junit.Test)1