Skip to content

Instantly share code, notes, and snippets.

@benixal
Last active December 22, 2022 14:56
Show Gist options
  • Save benixal/670014872d2600c04cce238f761d5a31 to your computer and use it in GitHub Desktop.
Save benixal/670014872d2600c04cce238f761d5a31 to your computer and use it in GitHub Desktop.
firestore rule : allow read, write only admin
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /chats/{userId}/{document=**} {
allow read, write: if
(
userId == request.auth.uid
&&
( !("resource" in request) || !("admin" in request.resource.data) )
)
||
request.auth.uid == 'UID'
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment