25 lines
617 B
PL/PgSQL
25 lines
617 B
PL/PgSQL
-- Deploy tipus:current_user_email to pg
|
|
-- requires: roles
|
|
-- requires: schema_tipus
|
|
|
|
begin;
|
|
|
|
set search_path to tipus;
|
|
|
|
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 publisher;
|
|
grant execute on function current_user_email() to admin;
|
|
|
|
commit;
|