comparison schema/auth_tests.sql @ 3024:5470aa3ffb9a

Fix privileges for GeoServer views
author Tom Gottfried <tom@intevation.de>
date Fri, 12 Apr 2019 11:41:24 +0200
parents 4374d942b23d
children ec6163c6687d
comparison
equal deleted inserted replaced
3023:5d06629a14df 3024:5470aa3ffb9a
12 -- * Tom Gottfried <tom@intevation.de> 12 -- * Tom Gottfried <tom@intevation.de>
13 13
14 -- 14 --
15 -- pgTAP test script for privileges and RLS policies 15 -- pgTAP test script for privileges and RLS policies
16 -- 16 --
17
18 CREATE FUNCTION test_privs() RETURNS SETOF TEXT AS
19 $$
20 DECLARE the_schema CONSTANT varchar = 'waterway';
21 DECLARE the_table varchar;
22 BEGIN
23 FOR the_table IN
24 SELECT table_name
25 FROM information_schema.tables
26 WHERE table_schema = the_schema
27 LOOP
28 RETURN NEXT table_privs_are(
29 the_schema,
30 the_table,
31 'waterway_user',
32 ARRAY['SELECT'],
33 format('waterway_user can SELECT from %I.%I',
34 the_schema, the_table));
35 END LOOP;
36 END;
37 $$ LANGUAGE plpgsql;
38 SELECT * FROM test_privs();
17 39
18 -- 40 --
19 -- Run tests as unprivileged user 41 -- Run tests as unprivileged user
20 -- 42 --
21 SET SESSION AUTHORIZATION test_user_at; 43 SET SESSION AUTHORIZATION test_user_at;