Pragy
11/05/2021, 7:25 PMjbergius
11/05/2021, 7:52 PMcreate policy "A test"
on companies
for all using (
auth.uid() in (
select user_id from connections
where company_id = id
)
);
would have hoped that this sholud work, but no luck :/jbergius
11/05/2021, 7:53 PMPragy
11/06/2021, 1:36 AMPragy
11/06/2021, 1:37 AMPragy
11/06/2021, 1:40 AMsql
create policy "Anyone can create a company" on companies for insert with check (true);
create policy "Users can view companies they are connected to" on companies for select using (exists (select 1 from connections where user_id=auth.uid() and company_id=id))
create policy "Users can update companies they are connected to" on companies for update with check (exists (select 1 from connections where user_id=auth.uid() and company_id=id))
create policy "Users can delete companies they are connected to" on companies for delete using (exists (select 1 from connections where user_id=auth.uid() and company_id=id))
jbergius
11/06/2021, 7:38 AM(
uid() IN (
SELECT
connections.user_id
FROM
connections
WHERE
(connections.company_id = companies.id)
)
)
jbergius
11/06/2021, 7:41 AMcreate policy "Anyone can create a company" on companies for insert with check (true);