diff --git a/docs/sql/order-groups-driver-update-policy.sql b/docs/sql/order-groups-driver-update-policy.sql new file mode 100644 index 0000000..d968328 --- /dev/null +++ b/docs/sql/order-groups-driver-update-policy.sql @@ -0,0 +1,8 @@ +-- 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()); \ No newline at end of file