Mercurial > gemma
comparison schema/manage_users_tests.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 | 92470caf81fd |
children | 72062ca52746 |
comparison
equal
deleted
inserted
replaced
262:92470caf81fd | 263:13ad969a9138 |
---|---|
11 'waterway_user', 'test0', 'secret1$', 'AT', NULL, 'test0') | 11 'waterway_user', 'test0', 'secret1$', 'AT', NULL, 'test0') |
12 $$, | 12 $$, |
13 42501, NULL, | 13 42501, NULL, |
14 'Less privileged user cannot call function in schema sys_admin'); | 14 'Less privileged user cannot call function in schema sys_admin'); |
15 | 15 |
16 -- | |
17 -- Role listing | |
18 -- | |
19 SET SESSION AUTHORIZATION test_user_at; | |
20 SELECT results_eq($$ | |
21 SELECT username FROM users.list_users | |
22 $$, | |
23 $$ | |
24 SELECT CAST(current_user AS varchar) | |
25 $$, | |
26 'User should only see his own profile'); | |
27 | |
28 SET SESSION AUTHORIZATION test_admin_at; | |
29 SELECT set_eq($$ | |
30 SELECT DISTINCT country FROM users.list_users | |
31 $$, | |
32 ARRAY['AT'], | |
33 'Waterway admin should only see profiles of his country'); | |
34 | |
16 SET SESSION AUTHORIZATION test_sys_admin1; | 35 SET SESSION AUTHORIZATION test_sys_admin1; |
17 | 36 SELECT set_eq($$ |
18 -- | 37 SELECT count(*) FROM users.list_users |
19 -- Role listing | 38 $$, |
20 -- | 39 ARRAY[4], |
21 SELECT isnt_empty($$ | 40 'System admin can see all users'); |
22 SELECT * FROM sys_admin.list_users | |
23 $$, | |
24 'List of users can be queried'); | |
25 | 41 |
26 -- | 42 -- |
27 -- Role creation | 43 -- Role creation |
28 -- | 44 -- |
29 SELECT lives_ok($$ | 45 SELECT lives_ok($$ |