mirror of
https://github.com/renee-png/acmcc.git
synced 2026-06-21 09:50:01 +00:00
Add ACMCC app source, Supabase backend, and project config
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
-- Allow RV renters/owners to discover and self-link a rental that was created
|
||||
-- with their email but never had user_id set yet. This supports the renter
|
||||
-- portal's email-based fallback (renters often have no owners record).
|
||||
|
||||
CREATE POLICY "RV renters can view rental matching their email"
|
||||
ON public.rv_boat_lot_rentals
|
||||
FOR SELECT
|
||||
TO authenticated
|
||||
USING (
|
||||
user_id IS NULL
|
||||
AND status = 'active'
|
||||
AND renter_email IS NOT NULL
|
||||
AND lower(renter_email) = lower(coalesce((auth.jwt() ->> 'email'), ''))
|
||||
);
|
||||
|
||||
CREATE POLICY "RV renters can self-link rental by email"
|
||||
ON public.rv_boat_lot_rentals
|
||||
FOR UPDATE
|
||||
TO authenticated
|
||||
USING (
|
||||
user_id IS NULL
|
||||
AND status = 'active'
|
||||
AND renter_email IS NOT NULL
|
||||
AND lower(renter_email) = lower(coalesce((auth.jwt() ->> 'email'), ''))
|
||||
)
|
||||
WITH CHECK (
|
||||
user_id = auth.uid()
|
||||
);
|
||||
Reference in New Issue
Block a user