Source:
public void testAccessControl() { assertAccessDenied("SELECT COUNT(true) FROM orders", "Cannot select from table .*.orders.*", privilege("orders", SELECT_TABLE)); assertAccessDenied("INSERT INTO orders SELECT * FROM orders", "Cannot insert into table .*.orders.*", privilege("orders", INSERT_TABLE)); assertAccessDenied("DELETE FROM orders", "Cannot delete from table .*.orders.*", privilege("orders", DELETE_TABLE)); assertAccessDenied("CREATE TABLE foo AS SELECT * FROM orders", "Cannot create table .*.foo.*", privilege("foo", CREATE_TABLE)); assertAccessDenied("SELECT n1.nationkey, n2.regionkey FROM nation n1, nation n2", "Cannot select from columns .nationkey, regionkey. in table .*.nation.*", privilege("nationkey", SELECT_COLUMN)); assertAccessDenied("SELECT count(name) as c FROM nation where comment > 'abc' GROUP BY regionkey having max(nationkey) > 10", "Cannot select from columns .name, nationkey, comment, regionkey. in table .*.nation.*", privilege("nationkey", SELECT_COLUMN)); assertAccessDenied("SELECT nationkey FROM (SELECT * FROM nation)", "Cannot select from columns .name, nationkey, comment, regionkey. in table .*.nation.*", privilege("nationkey", SELECT_COLUMN)); assertAccessDenied("SELECT 1 FROM region, nation where region.regionkey = nation.nationkey", "Cannot select from columns .nationkey. in table .*.nation.*", privilege("nationkey", SELECT_COLUMN)); }

Target:
public void testAccessControl() { assertAccessDenied("SELECT COUNT(true) FROM orders", "Cannot select from table .*.orders.*", privilege("orders", SELECT_TABLE)); assertAccessDenied("INSERT INTO orders SELECT * FROM orders", "Cannot insert into table .*.orders.*", privilege("orders", INSERT_TABLE)); assertAccessDenied("DELETE FROM orders", "Cannot delete from table .*.orders.*", privilege("orders", DELETE_TABLE)); assertAccessDenied("CREATE TABLE foo AS SELECT * FROM orders", "Cannot create table .*.foo.*", privilege("foo", CREATE_TABLE)); assertAccessDenied("SELECT * FROM nation", "Cannot select from columns \\[name, nationkey, comment, regionkey\\] in table .*.nation.*", privilege("nationkey", SELECT_COLUMN)); assertAccessDenied("SELECT * FROM (SELECT * FROM nation)", "Cannot select from columns \\[name, nationkey, comment, regionkey\\] in table .*.nation.*", privilege("nationkey", SELECT_COLUMN)); assertAccessDenied("SELECT name FROM (SELECT * FROM nation)", "Cannot select from columns \\[name, nationkey, comment, regionkey\\] in table .*.nation.*", privilege("nationkey", SELECT_COLUMN)); assertAccessAllowed("SELECT name FROM nation", privilege("nationkey", SELECT_COLUMN)); assertAccessDenied("SELECT n1.nationkey, n2.regionkey FROM nation n1, nation n2", "Cannot select from columns \\[nationkey, regionkey\\] in table .*.nation.*", privilege("nationkey", SELECT_COLUMN)); assertAccessDenied("SELECT count(name) as c FROM nation where comment > 'abc' GROUP BY regionkey having max(nationkey) > 10", "Cannot select from columns \\[name, nationkey, comment, regionkey\\] in table .*.nation.*", privilege("nationkey", SELECT_COLUMN)); assertAccessDenied("SELECT 1 FROM region, nation where region.regionkey = nation.nationkey", "Cannot select from columns \\[nationkey\\] in table .*.nation.*", privilege("nationkey", SELECT_COLUMN)); }