24 lines
591 B
PL/PgSQL
24 lines
591 B
PL/PgSQL
-- Deploy numerus:current_user_email to pg
|
|
-- requires: schema_numerus
|
|
|
|
begin;
|
|
|
|
set search_path to numerus;
|
|
|
|
create or replace function current_user_email() returns text as
|
|
$$
|
|
select current_setting('request.user.email', true);
|
|
$$
|
|
language sql
|
|
stable;
|
|
|
|
comment on function current_user_email() is
|
|
'Returns the email of the current Numerus user';
|
|
|
|
revoke execute on function current_user_email() from public;
|
|
grant execute on function current_user_email() to guest;
|
|
grant execute on function current_user_email() to invoicer;
|
|
grant execute on function current_user_email() to admin;
|
|
|
|
commit;
|