view schema/tap_tests_data.sql @ 319:ac760b0f22a9

Add special role for password reset As password reset is exposed without requiring a login, let this role have privileges limited to reseting passwords, and only reseting passwords.
author Tom Gottfried <tom@intevation.de>
date Thu, 02 Aug 2018 13:06:39 +0200
parents 92470caf81fd
children 5b03f420957d
line wrap: on
line source

--
-- Test data used in *_tests.sql scripts
--

INSERT INTO countries VALUES ('AT'), ('RO');

INSERT INTO users.responsibility_areas VALUES
    ('AT', ST_geomfromtext('MULTIPOLYGON(((0 0, 0 1, 1 1, 1 0, 0 0)))', 4326)),
    ('RO', ST_geomfromtext('MULTIPOLYGON(((1 0, 1 1, 2 1, 2 0, 1 0)))', 4326));

SELECT sys_admin.create_user(
    'waterway_user', 'test_user_at', 'user_at1$', 'AT', NULL, 'xxx');
SELECT sys_admin.create_user(
    'waterway_user', 'test_user_ro', 'user_ro1$', 'RO', NULL, 'xxy');
SELECT sys_admin.create_user(
    'waterway_admin', 'test_admin_at', 'admin_at1$', 'AT', NULL, 'yyy');
SELECT sys_admin.create_user(
    'sys_admin', 'test_sys_admin1', 'sys_admin1$', 'AT', NULL, 'zzz');

CREATE ROLE test_pw_reset IN ROLE pw_reset LOGIN PASSWORD 'ppp';

INSERT INTO limiting_factors VALUES ('depth'), ('width');

INSERT INTO waterway.gauges (
    location, function_code, objname, geom, zero_point, source_organization)
    VALUES (
        ('AT', 'XXX', '00001', '00000', 1)::isrs,
        'xxx',
        'testgauge',
        ST_geomfromtext('POINT(0 0)', 4326),
        0,
        'testorganization'
    );

INSERT INTO waterway.bottlenecks (
    bottleneck_id, fk_g_fid, stretch, area, rb, lb, responsible_country,
    revisiting_time, limiting, source_organization, staging_done)
    VALUES (
        'testbottleneck1',
        ('AT', 'XXX', '00001', '00000', 1)::isrs,
        isrsrange(('AT', 'XXX', '00001', '00000', 0)::isrs,
            ('AT', 'XXX', '00001', '00000', 2)::isrs),
        ST_geomfromtext('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))', 4326),
        'AT', 'AT', 'AT',
        1, 'depth', 'testorganization', false
    ), (
        'testbottleneck2',
        ('AT', 'XXX', '00001', '00000', 1)::isrs,
        isrsrange(('AT', 'XXX', '00001', '00000', 0)::isrs,
            ('AT', 'XXX', '00001', '00000', 2)::isrs),
        ST_geomfromtext('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))', 4326),
        'AT', 'AT', 'AT',
        1, 'depth', 'testorganization', true
    );

INSERT INTO users.templates (template_name, template_data)
    VALUES ('AT', '\x'), ('RO', '\x');
INSERT INTO users.user_templates
    VALUES ('test_user_at', 'AT'), ('test_user_ro', 'RO');