changeset 111:767f3edc502c

Fix infinite recursion and remove unnecessary WHERE clause.
author Tom Gottfried <tom@intevation.de>
date Fri, 15 Jun 2018 20:20:29 +0200
parents c86b20edb398
children 894f633e2d3f
files auth.sql
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/auth.sql	Fri Jun 15 20:16:53 2018 +0200
+++ b/auth.sql	Fri Jun 15 20:20:29 2018 +0200
@@ -82,10 +82,8 @@
            WHERE country = (SELECT country FROM user_profiles))));
 
 CREATE POLICY manage_templates ON templates FOR ALL TO waterway_admin
-       USING (id IN(SELECT t.id FROM templates t
-                    JOIN user_templates ut ON t.id = ut.template_id
+       USING (id IN(SELECT template_id FROM user_templates ut
                     JOIN user_profiles p ON ut.username = p.username
-                    WHERE p.country = (SELECT country FROM user_profiles
-                        WHERE username = current_user)));
+                    WHERE p.country = (SELECT country FROM user_profiles)));
 
 COMMIT;