# Script de déploiement des règles Firestore # Date : 15/01/2026 Write-Host "========================================" -ForegroundColor Cyan Write-Host " DÉPLOIEMENT RÈGLES FIRESTORE" -ForegroundColor Cyan Write-Host "========================================" -ForegroundColor Cyan Write-Host "" # Vérifier que Firebase CLI est installé Write-Host "Vérification Firebase CLI..." -ForegroundColor Yellow $firebaseCmd = Get-Command firebase -ErrorAction SilentlyContinue if ($null -eq $firebaseCmd) { Write-Host "❌ Firebase CLI n'est pas installé !" -ForegroundColor Red Write-Host "" Write-Host "Installation requise :" -ForegroundColor Yellow Write-Host " npm install -g firebase-tools" -ForegroundColor White Write-Host "" Write-Host "OU copier-coller manuellement dans Console Firebase" -ForegroundColor Yellow exit 1 } Write-Host "✓ Firebase CLI trouvé" -ForegroundColor Green Write-Host "" # Vérifier que le fichier firestore.rules existe if (-Not (Test-Path "firestore.rules")) { Write-Host "❌ Fichier firestore.rules introuvable !" -ForegroundColor Red Write-Host "Vérifiez que vous êtes dans le bon répertoire" -ForegroundColor Yellow exit 1 } Write-Host "✓ Fichier firestore.rules trouvé" -ForegroundColor Green Write-Host "" # Afficher un aperçu des règles pour les alertes Write-Host "Règles à déployer (extrait) :" -ForegroundColor Yellow Write-Host "------------------------------" -ForegroundColor Gray Get-Content "firestore.rules" | Select-String -Pattern "alerts" -Context 3 | Select-Object -First 10 Write-Host "------------------------------" -ForegroundColor Gray Write-Host "" # Demander confirmation Write-Host "Déployer les règles Firestore ? (O/N)" -ForegroundColor Yellow -NoNewline Write-Host " " -NoNewline $confirmation = Read-Host if ($confirmation -ne "O" -and $confirmation -ne "o") { Write-Host "Déploiement annulé" -ForegroundColor Yellow exit 0 } Write-Host "" Write-Host "Déploiement en cours..." -ForegroundColor Cyan # Déployer les règles try { firebase deploy --only firestore:rules Write-Host "" Write-Host "========================================" -ForegroundColor Green Write-Host " ✅ DÉPLOIEMENT RÉUSSI !" -ForegroundColor Green Write-Host "========================================" -ForegroundColor Green Write-Host "" Write-Host "Les règles Firestore ont été déployées avec succès." -ForegroundColor White Write-Host "" Write-Host "Prochaines étapes :" -ForegroundColor Yellow Write-Host " 1. Rafraîchir l'application (Ctrl+R)" -ForegroundColor White Write-Host " 2. Créer un événement pour tester" -ForegroundColor White Write-Host " 3. Vérifier qu'aucune erreur permission n'apparaît" -ForegroundColor White Write-Host "" } catch { Write-Host "" Write-Host "========================================" -ForegroundColor Red Write-Host " ❌ ERREUR DE DÉPLOIEMENT" -ForegroundColor Red Write-Host "========================================" -ForegroundColor Red Write-Host "" Write-Host "Erreur : $($_.Exception.Message)" -ForegroundColor Red Write-Host "" Write-Host "Solutions :" -ForegroundColor Yellow Write-Host " 1. Vérifier connexion : firebase login" -ForegroundColor White Write-Host " 2. Vérifier projet : firebase use" -ForegroundColor White Write-Host " 3. OU déployer via Console Firebase" -ForegroundColor White Write-Host "" exit 1 }