Mercurial > gemma
diff schema/auth_tests.sql @ 4740:2440d2f86f4e
Authorize sections based on country of creator
Disregarding the area of resposibility will allow to create sections
outside of the country of the user in order to allow data analysis
and aggregation based on sections spanning over multiple countries.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 18 Oct 2019 12:04:04 +0200 |
parents | 5466562cca60 |
children | dfd990a4ac64 |
line wrap: on
line diff
--- a/schema/auth_tests.sql Fri Oct 18 12:01:21 2019 +0200 +++ b/schema/auth_tests.sql Fri Oct 18 12:04:04 2019 +0200 @@ -15,17 +15,6 @@ -- pgTAP test script for privileges and RLS policies -- --- Helper function: -CREATE OR REPLACE FUNCTION users.current_user_country() - RETURNS internal.user_profiles.country%TYPE - AS $$ - SELECT country FROM users.list_users - WHERE username = current_user - $$ - LANGUAGE SQL - STABLE PARALLEL SAFE; - - CREATE FUNCTION test_privs() RETURNS SETOF TEXT AS $$ DECLARE the_schema CONSTANT varchar = 'waterway'; @@ -75,7 +64,7 @@ 'User should see templates associated to his country'); SELECT ok( - users.current_user_country() = ALL( + users.user_country() = ALL( SELECT country FROM users.templates), 'User should only see templates associated to his country');