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]))
)

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

Kind Regards,
Bram
Was this page helpful?