Skip to content

Commit

Permalink
Adjust grants after migration and give read access to DVH (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
geir-waagboe authored Jan 12, 2024
1 parent bca9229 commit 00efc3f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 23 deletions.
24 changes: 1 addition & 23 deletions src/main/resources/db/migration/R__grant_to_cloudsqliamuser.sql
Original file line number Diff line number Diff line change
@@ -1,25 +1,3 @@
REVOKE ALL ON ALL TABLES IN SCHEMA public FROM cloudsqliamuser;

-- GRANT SELECT ON ALL TABLES IN SCHEMA public TO cloudsqliamuser;
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO cloudsqliamuser;
GRANT USAGE ON ALL SEQUENCES IN SCHEMA public TO cloudsqliamuser;

DO $$
BEGIN
CREATE ROLE cloudsqlsuperuser WITH NOLOGIN;
EXCEPTION WHEN DUPLICATE_OBJECT THEN
RAISE NOTICE 'not creating role cloudsqlsuperuser -- it already exists';
END
$$;

GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO cloudsqlsuperuser;
GRANT USAGE ON ALL SEQUENCES IN SCHEMA public TO cloudsqlsuperuser;

DO $$
BEGIN
CREATE USER "esyfo-analyse";
EXCEPTION WHEN DUPLICATE_OBJECT THEN
RAISE NOTICE 'not creating role esyfo-analyse -- it already exists';
END
$$;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO "esyfo-analyse";
GRANT SELECT ON ALL TABLES IN SCHEMA public TO cloudsqliamuser;
9 changes: 9 additions & 0 deletions src/main/resources/db/migration/V1_6__grant_dvh.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
DO $$
BEGIN
CREATE USER "[email protected]";
EXCEPTION WHEN DUPLICATE_OBJECT THEN
RAISE NOTICE 'not creating user disykefravar -- it already exists';
END
$$;

GRANT SELECT ON motebehov to "[email protected]";
9 changes: 9 additions & 0 deletions src/main/resources/db/migration/V1_7__esyfo_analyse.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
DO $$
BEGIN
CREATE USER "esyfo-analyse";
EXCEPTION WHEN DUPLICATE_OBJECT THEN
RAISE NOTICE 'not creating role esyfo-analyse -- it already exists';
END
$$;

GRANT SELECT ON ALL TABLES IN SCHEMA public TO "esyfo-analyse";

0 comments on commit 00efc3f

Please sign in to comment.