camper/deploy/company_user.sql

27 lines
695 B
PL/PgSQL

-- Deploy camper:company_user to pg
-- requires: roles
-- requires: schema_camper
-- requires: user
-- requires: company
begin;
set search_path to camper, auth, public;
create table company_user (
company_id integer not null references company,
user_id integer not null references "user",
role name not null check (length(role) < 512),
primary key (company_id, user_id)
);
grant select on table company_user to employee;
grant select on table company_user to admin;
-- TODO:
-- I think we can enable row-level security for company_user because it would
-- be an infinite loop with user_profile, but in this case i think it is fine
-- because we can only see ids, nothing more.
commit;