espace-paie-odentas/scripts/verify-rls-facturation-informations.sql
2025-10-17 13:02:39 +02:00

52 lines
1.4 KiB
SQL
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- Vérification RLS pour FACTURATION et INFORMATIONS
-- Tables critiques: invoices, organization_details, productions
-- ==========================================
-- RÉSULTATS VÉRIFICATION (16 octobre 2025)
-- ==========================================
-- AVANT FIX:
-- - invoices: RLS ✅ (4 policies)
-- - organization_details: RLS ❌ (0 policies) → CRITIQUE
-- - productions: RLS ✅ (4 policies)
--
-- APRÈS FIX (fix-rls-organization-details.sql):
-- - invoices: RLS ✅ (4 policies)
-- - organization_details: RLS ✅ (4 policies) → CORRIGÉ
-- - productions: RLS ✅ (4 policies)
--
-- STATUT: 🟢 EXCELLENT - Toutes les tables protégées
-- ==========================================
-- 1⃣ VÉRIFICATION RLS ACTIVÉE
SELECT
schemaname,
tablename,
rowsecurity AS rls_enabled
FROM pg_tables
WHERE tablename IN ('invoices', 'organization_details', 'productions')
ORDER BY tablename;
-- 2⃣ POLITIQUES RLS EXISTANTES
SELECT
schemaname,
tablename,
policyname,
permissive,
roles,
cmd,
qual,
with_check
FROM pg_policies
WHERE tablename IN ('invoices', 'organization_details', 'productions')
ORDER BY tablename, cmd, policyname;
-- 3⃣ INDEX SUR org_id
SELECT
schemaname,
tablename,
indexname,
indexdef
FROM pg_indexes
WHERE tablename IN ('invoices', 'organization_details', 'productions')
AND indexdef ILIKE '%org_id%'
ORDER BY tablename, indexname;