Swaps the single fixed admin UUID that every admin-write/admin-read RLS policy and the frontend's ProtectedRoute check against, moving off the personal belviskhoremk@gmail.com account onto a dedicated admin@braidsbymira.com login created via the Auth admin API. Updates the RLS test suite's admin-impersonation UUID to match. Claude-Session: https://claude.ai/code/session_01NhxA4npAXAxmCDEJt6kxSH
42 lines
2.4 KiB
SQL
42 lines
2.4 KiB
SQL
-- Replaces the fixed admin UUID that every admin-write/admin-read RLS policy
|
|
-- checks against. The salon is switching its login from the personal
|
|
-- belviskhoremk@gmail.com account (21c90224-e0b2-412e-a431-8e7f097c1cef) to a
|
|
-- dedicated admin@braidsbymira.com account
|
|
-- (2b88676b-f901-459a-9147-b914190c4f81), created via the Auth admin API.
|
|
-- This is a swap, not an addition: the old UUID loses admin write access.
|
|
|
|
alter policy "products_admin_write" on public.products
|
|
using ((select auth.uid()) = '2b88676b-f901-459a-9147-b914190c4f81'::uuid)
|
|
with check ((select auth.uid()) = '2b88676b-f901-459a-9147-b914190c4f81'::uuid);
|
|
|
|
alter policy "services_admin_write" on public.services
|
|
using ((select auth.uid()) = '2b88676b-f901-459a-9147-b914190c4f81'::uuid)
|
|
with check ((select auth.uid()) = '2b88676b-f901-459a-9147-b914190c4f81'::uuid);
|
|
|
|
alter policy "schedule_template_admin_write" on public.schedule_template
|
|
using ((select auth.uid()) = '2b88676b-f901-459a-9147-b914190c4f81'::uuid)
|
|
with check ((select auth.uid()) = '2b88676b-f901-459a-9147-b914190c4f81'::uuid);
|
|
|
|
alter policy "schedule_exceptions_admin_write" on public.schedule_exceptions
|
|
using ((select auth.uid()) = '2b88676b-f901-459a-9147-b914190c4f81'::uuid)
|
|
with check ((select auth.uid()) = '2b88676b-f901-459a-9147-b914190c4f81'::uuid);
|
|
|
|
alter policy "bookings_admin_all" on public.bookings
|
|
using ((select auth.uid()) = '2b88676b-f901-459a-9147-b914190c4f81'::uuid)
|
|
with check ((select auth.uid()) = '2b88676b-f901-459a-9147-b914190c4f81'::uuid);
|
|
|
|
alter policy "booked_slots_admin_write" on public.booked_slots
|
|
using ((select auth.uid()) = '2b88676b-f901-459a-9147-b914190c4f81'::uuid)
|
|
with check ((select auth.uid()) = '2b88676b-f901-459a-9147-b914190c4f81'::uuid);
|
|
|
|
alter policy "inquiries_admin_all" on public.inquiries
|
|
using ((select auth.uid()) = '2b88676b-f901-459a-9147-b914190c4f81'::uuid)
|
|
with check ((select auth.uid()) = '2b88676b-f901-459a-9147-b914190c4f81'::uuid);
|
|
|
|
alter policy "notification_failures_admin_read" on public.notification_failures
|
|
using ((select auth.uid()) = '2b88676b-f901-459a-9147-b914190c4f81'::uuid);
|
|
|
|
alter policy "salon_images_admin_write" on storage.objects
|
|
using (bucket_id = 'salon-images' and (select auth.uid()) = '2b88676b-f901-459a-9147-b914190c4f81'::uuid)
|
|
with check (bucket_id = 'salon-images' and (select auth.uid()) = '2b88676b-f901-459a-9147-b914190c4f81'::uuid);
|