I'm trying to put together a RLS policy to only allow users enrolled in a course to view the discussions. There are two tables for the discussions, one with top-level threads and one with the replies.
Writing a policy for the reply table, I want to make sure only users who are enrolled in the course can select the replies, however there is no
course_id
course_id
column in this table. There is however a
thread_id
thread_id
which further references
course_id
course_id
. How can I make something like the following policy work?
(is_admin(uid()) OR has_course(thread_id.course_id, uid()))
(is_admin(uid()) OR has_course(thread_id.course_id, uid()))
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.