Skip to content

Commit

Permalink
Trenger ikke _så_ brede tilganger, kun select
Browse files Browse the repository at this point in the history
Co-authored-by: Sivert Frang Lunsæter <sivert.frang.lunseter@nav.no>
  • Loading branch information
chsko and sivertflu committed Jul 3, 2024
1 parent 9c43f2d commit 8816aa7
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
DO $$BEGIN
IF EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname = 'bigquery_datastream')
THEN
REVOKE USAGE, UPDATE ON ALL SEQUENCES IN SCHEMA public FROM "bigquery_datastream";
REVOKE INSERT, REFERENCES, TRIGGER, TRUNCATE, DELETE ON ALL TABLES IN SCHEMA public FROM "bigquery_datastream";
END IF;
END$$;

DO $$ BEGIN
IF EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname = 'bigquery_datastream')
THEN
ALTER DEFAULT PRIVILEGES FOR USER spaghet2 IN SCHEMA public GRANT SELECT ON SEQUENCES TO "bigquery_datastream";
ALTER DEFAULT PRIVILEGES FOR USER spaghet2 IN SCHEMA public GRANT SELECT ON TABLES TO "bigquery_datastream";
END IF;
END $$;

0 comments on commit 8816aa7

Please sign in to comment.