Complete the code to allow read access to all users.
create policy "Allow read access" on [1] for select using (true);
The policy must be created on a table to control read access.
Complete the code to restrict read access to authenticated users only.
create policy "Allow authenticated read" on users for select using (auth.uid() = [1]);
The column id typically stores the user identifier to match with auth.uid().
Fix the error in the policy condition to allow read access only if the user's role is 'reader'.
create policy "Role-based read access" on documents for select using (auth.role() = [1]);
String values in SQL conditions must be enclosed in single quotes, so use 'reader'.
Fill both blanks to create a policy that allows read access only if the user is authenticated and the record is not marked private.
create policy "Authenticated non-private read" on posts for select using (auth.uid() IS NOT NULL AND [1] = [2]);
The condition checks that the is_private column is false to allow read access.
Fill all three blanks to create a policy that allows read access if the user is the owner or the post is public.
create policy "Owner or public read" on posts for select using ([1] = auth.uid() OR [2] = [3]);
The policy checks if the owner_id matches the user or if is_public is true.
