kvnam
02/21/2022, 10:34 PMset
a custom variable app.current_user_role
on a table which will allow Select only if app.current_user_role
is admin
But when I run this via Prisma, it returns all the rows, irrespective of this value. I wanted to know if this is a good idea at all, or if getting Prisma to work with Supabase auth is still tricky and best not attempted right now? Any pointers in the right direction would be great, thanks!kvnam
02/21/2022, 10:49 PMpostgres
role, which has User bypasses every row level security policy
set to truekvnam
02/22/2022, 1:46 AMLOGIN
permissions, granted it all permissions on all public
schema tables. I then used these credentials with Prisma. Since this role did not have permission to bypass RLS policies, I was able to run SET app.current_user_role
through Prisma transactions / executeRaw and add the right checks in the RLS policy accordingly. This worked perfectly as expected.kvnam
02/22/2022, 1:47 AM