Currently as I have found out that the Supabase only exposes auth.uid() to do query related to the logged in user. So I can create, read, update and delete based on the user who is logged in, what I wanna do is to store new field "organization" with the user(I know how to do this) and then later I want to be able to do crud based on it like auth.organization(), is there any way to achieve query based on something like this auth.organization()?
You can encode it in the jwt and then access the JWT like so: https://supabase.com/docs/guides/auth/row-level-security#authjwt
create policy "User is in team"
on my_table
to authenticated
using ( team_id in (select auth.jwt() -> 'app_metadata' -> 'teams'));