Fix file sharing load speed and move error; misc updates
- Remove recursive directory size calculations (single Seafile API call per list) - Remove 'Used in this location' usage display - Fix move using v2 per-type endpoints instead of broken batch endpoint - Send entry type from frontend for correct move routing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,118 @@
|
||||
drop policy if exists "Auth users upload to submissions" on storage.objects;
|
||||
drop policy if exists "Auth users read submissions" on storage.objects;
|
||||
drop policy if exists "Team upload deliveries" on storage.objects;
|
||||
drop policy if exists "Auth users read deliveries" on storage.objects;
|
||||
|
||||
drop policy if exists "Team reads submissions storage" on storage.objects;
|
||||
create policy "Team reads submissions storage" on storage.objects
|
||||
for select to authenticated
|
||||
using (bucket_id = 'submissions' and get_my_role() = 'team');
|
||||
|
||||
drop policy if exists "Client reads submissions storage" on storage.objects;
|
||||
create policy "Client reads submissions storage" on storage.objects
|
||||
for select to authenticated
|
||||
using (
|
||||
bucket_id = 'submissions'
|
||||
and get_my_role() = 'client'
|
||||
and split_part(name, '/', 1) in (
|
||||
select t.id::text
|
||||
from public.tasks t
|
||||
join public.projects p on p.id = t.project_id
|
||||
where p.company_id = get_my_company_id()
|
||||
)
|
||||
);
|
||||
|
||||
drop policy if exists "External reads submissions storage" on storage.objects;
|
||||
create policy "External reads submissions storage" on storage.objects
|
||||
for select to authenticated
|
||||
using (
|
||||
bucket_id = 'submissions'
|
||||
and get_my_role() = 'external'
|
||||
and split_part(name, '/', 1) in (
|
||||
select t.id::text
|
||||
from public.tasks t
|
||||
join public.project_members pm on pm.project_id = t.project_id
|
||||
where pm.profile_id = auth.uid()
|
||||
)
|
||||
);
|
||||
|
||||
drop policy if exists "Team inserts submissions storage" on storage.objects;
|
||||
create policy "Team inserts submissions storage" on storage.objects
|
||||
for insert to authenticated
|
||||
with check (bucket_id = 'submissions' and get_my_role() = 'team');
|
||||
|
||||
drop policy if exists "Client inserts submissions storage" on storage.objects;
|
||||
create policy "Client inserts submissions storage" on storage.objects
|
||||
for insert to authenticated
|
||||
with check (
|
||||
bucket_id = 'submissions'
|
||||
and get_my_role() = 'client'
|
||||
and split_part(name, '/', 1) in (
|
||||
select t.id::text
|
||||
from public.tasks t
|
||||
join public.projects p on p.id = t.project_id
|
||||
where p.company_id = get_my_company_id()
|
||||
)
|
||||
);
|
||||
|
||||
drop policy if exists "External inserts submissions storage" on storage.objects;
|
||||
create policy "External inserts submissions storage" on storage.objects
|
||||
for insert to authenticated
|
||||
with check (
|
||||
bucket_id = 'submissions'
|
||||
and get_my_role() = 'external'
|
||||
and split_part(name, '/', 1) in (
|
||||
select t.id::text
|
||||
from public.tasks t
|
||||
join public.project_members pm on pm.project_id = t.project_id
|
||||
where pm.profile_id = auth.uid()
|
||||
)
|
||||
);
|
||||
|
||||
drop policy if exists "Team deletes submissions storage" on storage.objects;
|
||||
create policy "Team deletes submissions storage" on storage.objects
|
||||
for delete to authenticated
|
||||
using (bucket_id = 'submissions' and get_my_role() = 'team');
|
||||
|
||||
drop policy if exists "Team reads deliveries storage" on storage.objects;
|
||||
create policy "Team reads deliveries storage" on storage.objects
|
||||
for select to authenticated
|
||||
using (bucket_id = 'deliveries' and get_my_role() = 'team');
|
||||
|
||||
drop policy if exists "Client reads deliveries storage" on storage.objects;
|
||||
create policy "Client reads deliveries storage" on storage.objects
|
||||
for select to authenticated
|
||||
using (
|
||||
bucket_id = 'deliveries'
|
||||
and get_my_role() = 'client'
|
||||
and split_part(name, '/', 1) in (
|
||||
select t.id::text
|
||||
from public.tasks t
|
||||
join public.projects p on p.id = t.project_id
|
||||
where p.company_id = get_my_company_id()
|
||||
)
|
||||
);
|
||||
|
||||
drop policy if exists "External reads deliveries storage" on storage.objects;
|
||||
create policy "External reads deliveries storage" on storage.objects
|
||||
for select to authenticated
|
||||
using (
|
||||
bucket_id = 'deliveries'
|
||||
and get_my_role() = 'external'
|
||||
and split_part(name, '/', 1) in (
|
||||
select t.id::text
|
||||
from public.tasks t
|
||||
join public.project_members pm on pm.project_id = t.project_id
|
||||
where pm.profile_id = auth.uid()
|
||||
)
|
||||
);
|
||||
|
||||
drop policy if exists "Team inserts deliveries storage" on storage.objects;
|
||||
create policy "Team inserts deliveries storage" on storage.objects
|
||||
for insert to authenticated
|
||||
with check (bucket_id = 'deliveries' and get_my_role() = 'team');
|
||||
|
||||
drop policy if exists "Team deletes deliveries storage" on storage.objects;
|
||||
create policy "Team deletes deliveries storage" on storage.objects
|
||||
for delete to authenticated
|
||||
using (bucket_id = 'deliveries' and get_my_role() = 'team');
|
||||
Reference in New Issue
Block a user