© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago
FunHellion

RLS get operation

Hi there,

I've been working on RBAC using RLS. It works quite well but there is something I'd like to improve on.
Currently I have to create a policy for select, insert, update and delete instead of creating one for all.

Therefore I need to check for .select separate instead of just putting a function in there and checking that behind the scenes.
(
  (household_auth_for_heatpump(serial_number) AND has_permission(ARRAY['heatpumps.select.household'::text])) OR
  (team_auth_for_heatpump(serial_number) AND has_permission(ARRAY['heaptumps.select.team'::text])) OR
  (installer_company_auth_for_heatpump(serial_number) AND has_permission(ARRAY['heatpumps.select.company'::text]))
)
(
  (household_auth_for_heatpump(serial_number) AND has_permission(ARRAY['heatpumps.select.household'::text])) OR
  (team_auth_for_heatpump(serial_number) AND has_permission(ARRAY['heaptumps.select.team'::text])) OR
  (installer_company_auth_for_heatpump(serial_number) AND has_permission(ARRAY['heatpumps.select.company'::text]))
)

I was wondering if there is a way to get the operation from within the policy?

Kind Regards,
Bram
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

upsert() requires RLS SELECT operation?
SupabaseSSupabase / help-and-questions
4y ago
rls
SupabaseSSupabase / help-and-questions
4y ago
RLS
SupabaseSSupabase / help-and-questions
4y ago
rls issue
SupabaseSSupabase / help-and-questions
2w ago