Revert RLS policies for signatures
This commit is contained in:
@ -44,7 +44,7 @@ const Index = () => {
|
|||||||
|
|
||||||
const fetchSignatureCount = async () => {
|
const fetchSignatureCount = async () => {
|
||||||
const { count } = await supabase
|
const { count } = await supabase
|
||||||
.from('petition_signatures_public')
|
.from('petition_signatures')
|
||||||
.select('*', { count: 'exact', head: true });
|
.select('*', { count: 'exact', head: true });
|
||||||
|
|
||||||
setSignatureCount(count || 0);
|
setSignatureCount(count || 0);
|
||||||
|
|||||||
@ -47,16 +47,16 @@ const Testimonies = () => {
|
|||||||
|
|
||||||
const fetchSignatures = async () => {
|
const fetchSignatures = async () => {
|
||||||
try {
|
try {
|
||||||
// Get total count from public view (emails hidden)
|
// Get total count
|
||||||
const { count } = await supabase
|
const { count } = await supabase
|
||||||
.from('petition_signatures_public')
|
.from('petition_signatures')
|
||||||
.select('*', { count: 'exact', head: true });
|
.select('*', { count: 'exact', head: true });
|
||||||
|
|
||||||
setTotalCount(count || 0);
|
setTotalCount(count || 0);
|
||||||
|
|
||||||
// Get signatures with comments from public view (emails hidden)
|
// Get signatures with comments
|
||||||
const { data, error } = await supabase
|
const { data, error } = await supabase
|
||||||
.from('petition_signatures_public')
|
.from('petition_signatures')
|
||||||
.select('*')
|
.select('*')
|
||||||
.not('comment', 'is', null)
|
.not('comment', 'is', null)
|
||||||
.order('created_at', { ascending: false });
|
.order('created_at', { ascending: false });
|
||||||
|
|||||||
@ -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);
|
||||||
Reference in New Issue
Block a user