Different RLS (Row Level Security) between listing and viewing. #16696
Unanswered
enesozturk
asked this question in
Questions
Replies: 1 comment 5 replies
-
A default view will ignore the RLS on the table. I would create a view for your table and call that if public. But if all rows can be seen by the public why do you have your RLS for select at all? Just use a filter when you just want a users rows. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey everyone.
In Supabase, I have a table called
posts
. This table has columns that related to users;author
which keeps the id of the user who created that post.I created a Policy to enable RLS for the "posts" table. Now users only can list their own items. But I also have a post viewer page in my web app:
x.com/posts/{POST_UID}
. So on this page, I'm getting the posts in the following way:But the problem is, this page should be public and can be visible by anyone. Since posts table have policy. I cannot do that.
Is there any way to "list only users items, if they have a where clause with post UID, provide it".
I don't have expertise in SQL but I'm sure there are different solutions to provide it. I'm just curious about how to do this with Policies if it's possible.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions