Revert RLS policies for signatures

This commit is contained in:
gpt-engineer-app[bot]
2025-10-26 15:06:45 +00:00
parent 47ac10da2f
commit 1c36d5ef6e
3 changed files with 21 additions and 5 deletions

View File

@ -44,7 +44,7 @@ const Index = () => {
const fetchSignatureCount = async () => {
const { count } = await supabase
.from('petition_signatures_public')
.from('petition_signatures')
.select('*', { count: 'exact', head: true });
setSignatureCount(count || 0);

View File

@ -47,16 +47,16 @@ const Testimonies = () => {
const fetchSignatures = async () => {
try {
// Get total count from public view (emails hidden)
// Get total count
const { count } = await supabase
.from('petition_signatures_public')
.from('petition_signatures')
.select('*', { count: 'exact', head: true });
setTotalCount(count || 0);
// Get signatures with comments from public view (emails hidden)
// Get signatures with comments
const { data, error } = await supabase
.from('petition_signatures_public')
.from('petition_signatures')
.select('*')
.not('comment', 'is', null)
.order('created_at', { ascending: false });

View File

@ -0,0 +1,16 @@
-- Revert to public access policies
DROP POLICY IF EXISTS "Only authenticated users can view all signature data" ON public.petition_signatures;
DROP POLICY IF EXISTS "Anyone can sign the petition" ON public.petition_signatures;
-- Restore original public access
CREATE POLICY "Anyone can view signatures"
ON public.petition_signatures
FOR SELECT
TO anon, authenticated
USING (true);
CREATE POLICY "Anyone can sign the petition"
ON public.petition_signatures
FOR INSERT
TO anon, authenticated
WITH CHECK (true);