Skip to content

Instantly share code, notes, and snippets.

@nkmrh
Created June 29, 2018 00:23
Show Gist options
  • Save nkmrh/bd4d8852f066ba2d2f1ad5f86122c6b1 to your computer and use it in GitHub Desktop.
Save nkmrh/bd4d8852f066ba2d2f1ad5f86122c6b1 to your computer and use it in GitHub Desktop.
service cloud.firestore {
match /databases/{database}/documents {
function isAuthenticated() {
return request.auth != null;
}
function isBannedUser(userID) {
return exists(/databases/$(database)/documents/bannedUser/$(userID));
}
match /comment/{commentID} {
allow read: if isAuthenticated();
allow write: if isAuthenticated() &&
!isBannedUser(request.resource.data.userID);
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment