diff schema/auth.sql @ 263:13ad969a9138

Enable listing of users for all roles with appropriate filters Waterway users should see their own account data and their should be a single interface for account data (i.e. users.list_users). Therefore, also the RLS policy on user_profiles for waterway_admin is translated to the view. current_user_country() moved because it's needed earlier during database setup, now.
author Tom Gottfried <tom@intevation.de>
date Fri, 27 Jul 2018 19:03:56 +0200
parents 946baea3d280
children 72062ca52746
line wrap: on
line diff
--- a/schema/auth.sql	Fri Jul 27 15:26:16 2018 +0200
+++ b/schema/auth.sql	Fri Jul 27 19:03:56 2018 +0200
@@ -79,17 +79,6 @@
 -- RLS policies for waterway_admin
 --
 
--- Security-definer function to get current users country, which allows to
--- restrict the view on user_profiles by country without infinite recursion
-CREATE FUNCTION current_user_country()
-    RETURNS users.user_profiles.country%TYPE
-    AS $$
-        SELECT country FROM users.user_profiles WHERE username = session_user
-    $$
-    LANGUAGE SQL
-    SECURITY DEFINER
-    STABLE PARALLEL SAFE;
-
 -- Staging area
 -- TODO: add all relevant tables here
 CREATE POLICY responsibility_area ON waterway.bottlenecks