mirror of
https://github.com/renee-png/acmcc.git
synced 2026-06-21 01:40:01 +00:00
183fe0a93c
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
39 lines
1.2 KiB
SQL
39 lines
1.2 KiB
SQL
-- Allow any authenticated user to insert their own comments
|
|
CREATE POLICY "Authenticated users can insert own entity_comments"
|
|
ON public.entity_comments
|
|
FOR INSERT
|
|
TO authenticated
|
|
WITH CHECK (auth.uid() = user_id);
|
|
|
|
-- Allow any authenticated user to insert their own votes
|
|
CREATE POLICY "Authenticated users can insert own entity_votes"
|
|
ON public.entity_votes
|
|
FOR INSERT
|
|
TO authenticated
|
|
WITH CHECK (auth.uid() = user_id);
|
|
|
|
-- Allow any authenticated user to update their own votes
|
|
CREATE POLICY "Authenticated users can update own entity_votes"
|
|
ON public.entity_votes
|
|
FOR UPDATE
|
|
TO authenticated
|
|
USING (auth.uid() = user_id)
|
|
WITH CHECK (auth.uid() = user_id);
|
|
|
|
-- Allow any authenticated user to delete their own votes
|
|
CREATE POLICY "Authenticated users can delete own entity_votes"
|
|
ON public.entity_votes
|
|
FOR DELETE
|
|
TO authenticated
|
|
USING (auth.uid() = user_id);
|
|
|
|
-- Allow any authenticated user to delete their own comments
|
|
CREATE POLICY "Authenticated users can delete own entity_comments"
|
|
ON public.entity_comments
|
|
FOR DELETE
|
|
TO authenticated
|
|
USING (auth.uid() = user_id);
|
|
|
|
-- Enable realtime for both tables
|
|
ALTER PUBLICATION supabase_realtime ADD TABLE public.entity_votes;
|
|
ALTER PUBLICATION supabase_realtime ADD TABLE public.entity_comments; |