|
| 1 | +BEGIN; |
| 2 | + |
| 3 | +CREATE TABLE permissions.t_desired_permission |
| 4 | +( |
| 5 | + id int4 PRIMARY KEY, |
| 6 | + rolname text, |
| 7 | + perms text[], |
| 8 | + operation text, |
| 9 | + obj text, |
| 10 | + sub_obj text |
| 11 | +); |
| 12 | + |
| 13 | +INSERT INTO permissions.t_desired_permission |
| 14 | + VALUES (1, 'anon', '{"SELECT", "INSERT"}', 'all_tables_in_schema', 'public', NULL), |
| 15 | + -- anon should have SELECT and INSERT in all tables in schema public |
| 16 | + |
| 17 | + (2, NULL, '{"SELECT"}', 'all_tables_in_schema', 'sales', NULL), |
| 18 | + -- everbody should have SELECT on all tables in schema sales |
| 19 | + |
| 20 | + (3, NULL, '{"USAGE"}', 'all_schemas', NULL, NULL), |
| 21 | + -- everybody should have usage rights in all schemas |
| 22 | + |
| 23 | + (4, 'joe', '{"SELECT"}', 'on_table', 'public', 't_test'), |
| 24 | + -- joe should have SELECT on table public.t_test |
| 25 | + |
| 26 | + (5, NULL, '{"SELECT", "INSERT"}', NULL, NULL, NULL), |
| 27 | + -- everbody should have SELECT and INSERT on all tables and views in all schemas |
| 28 | + |
| 29 | + (6, 'joe', '{"SELECT"}', 'on_view', 'public', 'v_test'), |
| 30 | + -- joe should have SELECT on view public.v_test |
| 31 | + |
| 32 | + (7, NULL, '{"EXECUTE"}', 'on_functions_in_schema', 'public', NULL) |
| 33 | + -- everbody should have EXECUTE on all function in schema public |
| 34 | +; |
| 35 | + |
| 36 | +ROLLBACK; |
| 37 | + |
0 commit comments