Add Security to Citizen
This commit is contained in:
@@ -3,12 +3,13 @@ $$
|
||||
declare
|
||||
new_id uuid;
|
||||
begin
|
||||
insert into "user" (id, username, password, blocked_at)
|
||||
insert into "user" (id, username, password, blocked_at, roles)
|
||||
select
|
||||
coalesce(t.id, uuid_generate_v4()),
|
||||
t.username,
|
||||
crypt(resource->>'plain_password', gen_salt('bf', 8)),
|
||||
case when t.blocked_at is not null then now() else null end
|
||||
case when t.blocked_at is not null then now() else null end,
|
||||
t.roles
|
||||
from json_populate_record(null::"user", resource) t
|
||||
returning id into new_id;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user