diff schema/auth.sql @ 1780:48791416bea5

(Approved) gauge measurement import: Fixed row level security.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 11 Jan 2019 16:48:14 +0100
parents eeb291c3f9b0
children 30c76168e6d0
line wrap: on
line diff
--- a/schema/auth.sql	Fri Jan 11 15:40:50 2019 +0100
+++ b/schema/auth.sql	Fri Jan 11 16:48:14 2019 +0100
@@ -77,8 +77,7 @@
 DECLARE the_table varchar;
 BEGIN
     FOREACH the_table IN ARRAY ARRAY[
-       -- 'gauge_measurements', XXX Removed since this table has currently no
-    -- staging
+        'gauge_measurements',
         'sections_stretches',
         'waterway_profiles',
         'fairway_dimensions',
@@ -143,6 +142,10 @@
 -- Staging area
 -- TODO: add all relevant tables here
 
+CREATE POLICY same_country ON waterway.gauge_measurements
+    FOR ALL TO waterway_admin
+    USING (country_code = users.current_user_country());
+
 CREATE POLICY responsibility_area ON waterway.bottlenecks
     FOR ALL TO waterway_admin
     USING (utm_covers(area));