Does anybody have an example where a user's `uid` ...
# help
e
Does anybody have an example where a user's
uid
is checked within an array or jsonb cell for their RLS policy? What I want: An RLS policy which checks if
auth.uid()
is a value within a
players
array or jsonb column cell to determine if they should be able to see the
/game/uuid
page.
n
Hello @eoin! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
/title
command! We have solved your problem? Click the button below to archive it.
🆕 ArrayJSON RLS policy checks with auth.uid()?
🆕 Array or JSON RLS policy checks with auth.uid?
g
https://supabase.com/docs/guides/auth/row-level-security#advanced-policies look at
Copy code
create policy "Logged in users can see the posts if they belong to the post 'audience'."
on posts
for select
using (
  auth.uid() = any (posts.audience)
);
n
Array or JSON RLS policy checks with auth.uid?
e
@garyaustin it worked—thanks so much! 🙏 I didn't think to declare the column as an array of
uuid
values and my SQL expression on the policy was incorrect.
n
Thread was archived by @eoin. Anyone can send a message to unarchive it.