-- Enable public read access to bootcamp curriculum for product detail pages -- This allows unauthenticated users to see the curriculum preview -- Enable RLS on bootcamp_modules (if not already enabled) ALTER TABLE bootcamp_modules ENABLE ROW LEVEL SECURITY; -- Enable RLS on bootcamp_lessons (if not already enabled) ALTER TABLE bootcamp_lessons ENABLE ROW LEVEL SECURITY; -- Drop existing policies if they exist (to avoid conflicts) DROP POLICY IF EXISTS "Public can view bootcamp modules" ON bootcamp_modules; DROP POLICY IF EXISTS "Public can view bootcamp lessons" ON bootcamp_lessons; DROP POLICY IF EXISTS "Authenticated can view bootcamp modules" ON bootcamp_modules; DROP POLICY IF EXISTS "Authenticated can view bootcamp lessons" ON bootcamp_lessons; -- Create policy for public read access to bootcamp_modules -- Anyone can view modules to see curriculum preview CREATE POLICY "Public can view bootcamp modules" ON bootcamp_modules FOR SELECT TO public, authenticated USING (true); -- Create policy for public read access to bootcamp_lessons -- Anyone can view lessons to see curriculum preview CREATE POLICY "Public can view bootcamp lessons" ON bootcamp_lessons FOR SELECT TO public, authenticated USING (true); -- Comment explaining the policies COMMENT ON POLICY "Public can view bootcamp modules" ON bootcamp_modules IS 'Allows public read access to bootcamp curriculum for product detail pages'; COMMENT ON POLICY "Public can view bootcamp lessons" ON bootcamp_lessons IS 'Allows public read access to bootcamp lessons for curriculum preview';