fix: acting_usr fns
All checks were successful
gen-migrations / gen-migrations (push) Successful in 19s
All checks were successful
gen-migrations / gen-migrations (push) Successful in 19s
This commit is contained in:
parent
27a69a5482
commit
aad2e076fe
@ -4,7 +4,19 @@ create function public.set_acting_usr(uid text)
|
|||||||
volatile
|
volatile
|
||||||
as $$
|
as $$
|
||||||
begin
|
begin
|
||||||
set session "dnim.usr_uid" = uid;
|
if uid is not null and uid != '' then
|
||||||
|
perform set_config('dnim.usr_uid', uid, false);
|
||||||
|
end if;
|
||||||
|
end;
|
||||||
|
$$;
|
||||||
|
|
||||||
|
create function public.unset_acting_usr()
|
||||||
|
returns void
|
||||||
|
language plpgsql
|
||||||
|
volatile
|
||||||
|
as $$
|
||||||
|
begin
|
||||||
|
perform set_config('dnim.usr_uid', '', false);
|
||||||
end;
|
end;
|
||||||
$$;
|
$$;
|
||||||
|
|
||||||
@ -14,7 +26,6 @@ create function public.get_acting_usr()
|
|||||||
volatile
|
volatile
|
||||||
as $$
|
as $$
|
||||||
declare
|
declare
|
||||||
uid text;
|
|
||||||
acting_usr public.usr;
|
acting_usr public.usr;
|
||||||
begin
|
begin
|
||||||
if nullif(current_setting('dnim.usr_uid', true), '') is null then
|
if nullif(current_setting('dnim.usr_uid', true), '') is null then
|
||||||
@ -26,6 +37,6 @@ begin
|
|||||||
into acting_usr;
|
into acting_usr;
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
return acting_usr;
|
return coalesce(acting_usr, public.usr_root());
|
||||||
end;
|
end;
|
||||||
$$;
|
$$;
|
||||||
|
Loading…
Reference in New Issue
Block a user