camper/deploy/company_user_profile.sql

26 lines
515 B
PL/PgSQL

-- Deploy camper:company_user_profile to pg
-- requires: roles
-- requires: schema_camper
-- requires: user
-- requires: company_user
-- requires: current_company_id
begin;
set search_path to camper, public;
create or replace view company_user_profile with (security_barrier) as
select user_id
, email
, name
, role
, lang_tag
from auth."user"
join company_user using (user_id)
where company_id = current_company_id()
;
grant select on table company_user_profile to admin;
commit;