Skip to content

Commit 6f873ab

Browse files
Fix billing records RLS
1 parent ece48a1 commit 6f873ab

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
-- Add remaining policies for billing_records security
2+
3+
-- System can create billing records (for automated processing)
4+
CREATE POLICY "System can create billing records"
5+
ON public.billing_records
6+
FOR INSERT
7+
TO authenticated
8+
WITH CHECK (auth.uid() = user_id);
9+
10+
-- Allow limited updates (only status field changes)
11+
CREATE POLICY "Users can update billing record status only"
12+
ON public.billing_records
13+
FOR UPDATE
14+
TO authenticated
15+
USING (auth.uid() = user_id);
16+
17+
-- No deletion of billing records for audit trail integrity
18+
CREATE POLICY "Billing records cannot be deleted"
19+
ON public.billing_records
20+
FOR DELETE
21+
TO authenticated
22+
USING (false);

0 commit comments

Comments
 (0)