Skip to content

Commit 9696a06

Browse files
committed
added macrostrat permissions to tile table
1 parent 5b5e47c commit 9696a06

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

schema/_analytics/analytics.sql

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--shows all the permissions of a given user and table
2+
SELECT
3+
has_table_privilege('macrostrat', 'tile_cache.tile_info', 'SELECT') AS can_select,
4+
has_table_privilege('macrostrat', 'tile_cache.tile_info', 'INSERT') AS can_insert,
5+
has_table_privilege('macrostrat', 'tile_cache.tile_info', 'UPDATE') AS can_update,
6+
has_table_privilege('macrostrat', 'tile_cache.tile_info', 'DELETE') AS can_delete,
7+
has_table_privilege('macrostrat', 'tile_cache.tile_info', 'TRUNCATE') AS can_truncate,
8+
has_table_privilege('macrostrat', 'tile_cache.tile_info', 'REFERENCES') AS can_references,
9+
has_table_privilege('macrostrat', 'tile_cache.tile_info', 'TRIGGER') AS can_trigger,
10+
has_schema_privilege('macrostrat', 'tile_cache', 'USAGE') AS can_use_schema,
11+
has_table_privilege('macrostrat', 'tile_cache.tile_info', 'SELECT') AS macrostrat_can_select;

schema/core/9500-permissions.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,11 @@ CREATE OR REPLACE FUNCTION current_app_role() -- returns text
7373
AS $$
7474
SELECT (current_setting('request.jwt.claims', true)::json ->> 'role')::text;
7575
$$;
76+
77+
--tileserver permissions
78+
GRANT USAGE ON SCHEMA tile_cache TO macrostrat;
79+
GRANT SELECT ON TABLE tile_cache.tile TO macrostrat;
80+
GRANT INSERT, UPDATE ON TABLE tile_cache.tile TO macrostrat;
81+
ALTER DEFAULT PRIVILEGES IN SCHEMA tile_cache
82+
GRANT SELECT ON TABLES TO macrostrat;
83+

0 commit comments

Comments
 (0)