Skip to content

RLS policy using an OR clause #29634

Closed Answered by GaryAustin1
jordanpapaleo asked this question in Questions
Discussion options

You must be logged in to vote

So your policy will show a user's own row if auth.uid() matches id. Then it will also show any row with 'admin' in the role column or 'team' in the role column. Not sure how those are useful to you. It has nothing to do with the current user executing the call, but with the a fixed compare of that column to a string.

Maybe say what your goal is. If it is you have users with that role access all rows or something like that then you would need a policy that actually queries the table itself based on auth.uid() to see if the user has that role and then allow access to all rows based on that. That would be done with a security definer function.

Also you are not clear on what policy this is fo…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@jordanpapaleo
Comment options

@jordanpapaleo
Comment options

@GaryAustin1
Comment options

Answer selected by GaryAustin1
@jordanpapaleo
Comment options

@GaryAustin1
Comment options

@jordanpapaleo
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants