25 lines
615 B
PL/PgSQL
25 lines
615 B
PL/PgSQL
-- Deploy camper:current_user_cookie to pg
|
|
-- requires: roles
|
|
-- requires: schema_camper
|
|
|
|
begin;
|
|
|
|
set search_path to camper;
|
|
|
|
create or replace function current_user_cookie() returns text as
|
|
$$
|
|
select current_setting('request.user.cookie', true);
|
|
$$
|
|
language sql
|
|
stable;
|
|
|
|
comment on function current_user_cookie() is
|
|
'Returns the cookie of the current Camper user';
|
|
|
|
revoke execute on function current_user_cookie() from public;
|
|
grant execute on function current_user_cookie() to guest;
|
|
grant execute on function current_user_cookie() to employee;
|
|
grant execute on function current_user_cookie() to admin;
|
|
|
|
commit;
|