Files
prayer-app/firestore.rules
T
nmemmert 9f799397c8 Implement cross-device prayer synchronization
- Replace localStorage with Firestore for prayer persistence
- Prayers now sync across all devices when logged in
- Add userId to prayers for proper user association
- Update archive/unarchive to work with Firestore
- Update Firestore rules for user-specific prayer access
- Remove localStorage dependencies
2025-10-22 14:27:39 -04:00

37 lines
1.1 KiB
Plaintext

rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Allow authenticated users to read/write their own data
match /users/{userId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
// Allow authenticated users to read/write their own prayers
match /prayers/{prayerId} {
allow read, write: if request.auth != null &&
resource.data.userId == request.auth.uid;
allow create: if request.auth != null &&
request.resource.data.userId == request.auth.uid;
}
// Allow server-side API access for scheduled emails (no auth required for GET)
match /prayers {
allow read: if true;
}
// Allow server-side API access for scheduled emails
match /users {
allow read: if true;
}
// Allow authenticated users to read/write config (for admin settings)
match /config/{configId} {
allow read, write: if request.auth != null;
}
// Allow anyone to read public data (if needed in future)
match /public/{document} {
allow read: if true;
}
}
}