use of io.trino.eventlistener.EventListenerConfig in project trino by trinodb.
the class TestCreateTableTask method testCreateLikeDenyPermission.
@Test
public void testCreateLikeDenyPermission() {
CreateTable statement = getCreatleLikeStatement(false);
TestingAccessControlManager accessControl = new TestingAccessControlManager(transactionManager, new EventListenerManager(new EventListenerConfig()));
accessControl.deny(privilege("parent_table", SELECT_COLUMN));
CreateTableTask createTableTask = new CreateTableTask(plannerContext, accessControl, columnPropertyManager, tablePropertyManager);
assertThatThrownBy(() -> getFutureValue(createTableTask.internalExecute(statement, testSession, List.of(), output -> {
}))).isInstanceOf(AccessDeniedException.class).hasMessageContaining("Cannot reference columns of table");
}
use of io.trino.eventlistener.EventListenerConfig in project trino by trinodb.
the class TestCreateTableTask method testCreateLikeWithPropertiesDenyPermission.
@Test
public void testCreateLikeWithPropertiesDenyPermission() {
CreateTable statement = getCreatleLikeStatement(true);
TestingAccessControlManager accessControl = new TestingAccessControlManager(transactionManager, new EventListenerManager(new EventListenerConfig()));
accessControl.deny(privilege("parent_table", SHOW_CREATE_TABLE));
CreateTableTask createTableTask = new CreateTableTask(plannerContext, accessControl, columnPropertyManager, tablePropertyManager);
assertThatThrownBy(() -> getFutureValue(createTableTask.internalExecute(statement, testSession, List.of(), output -> {
}))).isInstanceOf(AccessDeniedException.class).hasMessageContaining("Cannot reference properties of table");
}
Aggregations