Skip to content

Instantly share code, notes, and snippets.

@kmaida
Last active March 25, 2021 17:52
Show Gist options
  • Save kmaida/de3551e5675b6ea57053f6caf03a25bf to your computer and use it in GitHub Desktop.
Save kmaida/de3551e5675b6ea57053f6caf03a25bf to your computer and use it in GitHub Desktop.
Firebase Cloud Firestore rules: all users can read, authenticated users can create if they provide a UID, owner can delete, owner can update.
service cloud.firestore {
match /databases/{database}/documents {
match /<COLLECTION_NAME>/{document=**} {
allow read: if true;
allow create: if request.auth != null && request.auth.uid == request.resource.data.uid;
allow update, delete: if request.auth != null && request.auth.uid == resource.data.uid;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment