leafittome/storage.rules
cschlaefke 41e31bed88 Foto-Flow mit KI-Erkennung: Kamera, Cloud Function identifyPlant, Storage für Fotos
- Cloud Function (europe-west3): PlantNet-Erkennung mit Claude-Fallback, deutsches Pflegeprofil von Claude, Keys als Secrets
- Pflanzen-Formular: Foto aufnehmen/wählen, Felder werden automatisch vorbefüllt
- Fotos in Storage unter households/{id}/plant-photos, Anzeige in Liste und Profil
- storage.rules mit Haushalts-Prinzip, iOS-Berechtigungstexte für Kamera/Fotos
- Doku Schritt 5: Storage aktivieren, PlantNet-Key, Secrets setzen

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 00:05:46 +02:00

21 lines
690 B
Text

rules_version = '2';
// Foto-Speicher: gleiche Logik wie Firestore — Zugriff nur für
// Mitglieder des jeweiligen Haushalts (Abgleich über Firestore).
service firebase.storage {
match /b/{bucket}/o {
match /households/{householdId}/{allPaths=**} {
allow read: if isMember(householdId);
allow write: if isMember(householdId)
&& request.resource.size < 10 * 1024 * 1024
&& request.resource.contentType.matches('image/.*');
}
function isMember(householdId) {
return request.auth != null
&& request.auth.uid in firestore.get(
/databases/(default)/documents/households/$(householdId)
).data.memberUids;
}
}
}