From 91387bc25417f2f18e9c53f0abbca2cbeb1efa98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geir=20Arne=20Waagb=C3=B8?= <79845894+geir-waagboe@users.noreply.github.com> Date: Tue, 23 Jan 2024 12:41:58 +0100 Subject: [PATCH] Give read access on motebehov to DVH except two columns (#292) --- .../migration/R__grant_to_cloudsqliamuser.sql | 4 +++ .../resources/db/migration/V1_9__view_dvh.sql | 25 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 src/main/resources/db/migration/V1_9__view_dvh.sql diff --git a/src/main/resources/db/migration/R__grant_to_cloudsqliamuser.sql b/src/main/resources/db/migration/R__grant_to_cloudsqliamuser.sql index aae31c39..04da9ed1 100644 --- a/src/main/resources/db/migration/R__grant_to_cloudsqliamuser.sql +++ b/src/main/resources/db/migration/R__grant_to_cloudsqliamuser.sql @@ -1,3 +1,7 @@ REVOKE ALL ON ALL TABLES IN SCHEMA public FROM cloudsqliamuser; +REVOKE ALL ON ALL TABLES IN SCHEMA public FROM "disykefravar-x4wt@knada-gcp.iam"; +REVOKE ALL ON ALL TABLES IN SCHEMA public FROM "disykefravar-x4wt@knada-gcp.iam.gserviceaccount.com"; GRANT SELECT ON ALL TABLES IN SCHEMA public TO cloudsqliamuser; + +GRANT SELECT ON MOTEBEHOV_DVH TO "disykefravar-x4wt@knada-gcp.iam.gserviceaccount.com"; diff --git a/src/main/resources/db/migration/V1_9__view_dvh.sql b/src/main/resources/db/migration/V1_9__view_dvh.sql new file mode 100644 index 00000000..05167aa4 --- /dev/null +++ b/src/main/resources/db/migration/V1_9__view_dvh.sql @@ -0,0 +1,25 @@ +CREATE VIEW MOTEBEHOV_DVH ( + motebehov_uuid, + opprettet_dato, + opprettet_av, + virksomhetsnummer, + har_motebehov, + tildelt_enhet, + behandlet_tidspunkt, + behandlet_veileder_ident, + skjematype, + sm_fnr, + opprettet_av_fnr +) AS SELECT + motebehov_uuid, + opprettet_dato, + opprettet_av, + virksomhetsnummer, + har_motebehov, + tildelt_enhet, + behandlet_tidspunkt, + behandlet_veileder_ident, + skjematype, + sm_fnr, + opprettet_av_fnr +FROM MOTEBEHOV; \ No newline at end of file