Add public read access to bootcamp curriculum tables
- Enable RLS on bootcamp_modules and bootcamp_lessons tables - Add public SELECT policies so unauthenticated users can view curriculum - This allows kurikulum card to be displayed on bootcamp product detail pages - Both public and authenticated roles can read the curriculum data 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
-- 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';
|
||||
Reference in New Issue
Block a user