Complete the code to allow authenticated users to select files from storage.
create policy "Allow authenticated read" on storage.objects for select to [1] using (auth.role() = 'authenticated');
The policy must specify the role 'authenticated' to allow only logged-in users to select files.
Complete the code to allow users to insert files only if they own the file.
create policy "Allow insert if owner" on storage.objects for insert to authenticated with check (auth.uid() = [1]);
The check must compare the authenticated user's ID with the user ID in the request, so metadata->>'owner' is correct.
Fix the error in the policy to allow users to delete only their own files.
create policy "Allow delete own files" on storage.objects for delete to authenticated using (auth.uid() = [1]);
The ownership is stored in the file metadata under 'owner', so the check must use metadata->>'owner'.
Fill both blanks to allow users to update files only if they own them and are authenticated.
create policy "Allow update own files" on storage.objects for update to [1] using (auth.uid() = [2]);
The policy must apply to authenticated users and check ownership via metadata->>'owner'.
Fill all three blanks to create a policy that allows authenticated users to select files only from their own bucket and if they own the file.
create policy "Allow select own bucket files" on storage.objects for select to [1] using (bucket_id = [2] and auth.uid() = [3]);
The policy applies to authenticated users, checks the bucket_id equals 'user_bucket', and verifies ownership via metadata->>'owner'.
