supersam/docs/sql/order-groups-driver-update-...

8 lines
386 B
SQL

-- Allow drivers to update order_groups where they are assigned
-- This enables saving shipment data and updating delivery status
CREATE POLICY "order groups driver update shipment data"
ON public.order_groups
FOR UPDATE
TO public
USING (current_role_name() = 'driver' AND assigned_driver_id = auth.uid())
WITH CHECK (current_role_name() = 'driver' AND assigned_driver_id = auth.uid());