comparison schema/gemma.sql @ 5496:8797274e2739 deactivate-users

Added a active column to users.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 21 Sep 2021 15:31:26 +0200
parents 345515bc4548
children 796196f83678
comparison
equal deleted inserted replaced
5495:0766dcb7e7f8 5496:8797274e2739
383 CHECK(to_regrole(quote_ident(username)) IS NOT NULL), 383 CHECK(to_regrole(quote_ident(username)) IS NOT NULL),
384 -- keep username length compatible with role identifier 384 -- keep username length compatible with role identifier
385 country char(2) NOT NULL REFERENCES countries, 385 country char(2) NOT NULL REFERENCES countries,
386 map_extent box2d NOT NULL, 386 map_extent box2d NOT NULL,
387 email_address varchar NOT NULL, 387 email_address varchar NOT NULL,
388 report_reciever boolean NOT NULL DEFAULT false 388 report_reciever boolean NOT NULL DEFAULT false,
389 active boolean NOT NULL DEFAULT true
389 ) 390 )
390 ; 391 ;
391 392
392 393
393 -- Namespace to be accessed by sys_admin only 394 -- Namespace to be accessed by sys_admin only
498 p.username, 499 p.username,
499 CAST('' AS varchar) AS pw, 500 CAST('' AS varchar) AS pw,
500 p.country, 501 p.country,
501 p.map_extent, 502 p.map_extent,
502 p.email_address, 503 p.email_address,
503 p.report_reciever 504 p.report_reciever,
505 p.active
504 FROM internal.user_profiles p 506 FROM internal.user_profiles p
505 JOIN pg_roles u ON p.username = u.rolname 507 JOIN pg_roles u ON p.username = u.rolname
506 JOIN pg_auth_members a ON u.oid = a.member 508 JOIN pg_auth_members a ON u.oid = a.member
507 JOIN pg_roles r ON a.roleid = r.oid 509 JOIN pg_roles r ON a.roleid = r.oid
508 WHERE p.username = current_user 510 WHERE p.username = current_user