Skip to content

Instantly share code, notes, and snippets.

@SUPERCILEX
Created October 4, 2017 04:24
Show Gist options
  • Save SUPERCILEX/cd9902ccaa5d448baa9c6830a26ab6fd to your computer and use it in GitHub Desktop.
Save SUPERCILEX/cd9902ccaa5d448baa9c6830a26ab6fd to your computer and use it in GitHub Desktop.
service cloud.firestore {
match /databases/{database}/documents {
// Incorrect solution
match /public/{doc=**} {
allow read;
match /foo/{bar} {
allow write: if doc == "foobar"; // Error! "doc" is a path object, not a string
}
}
// Correct solution
match /public/{doc} {
allow read;
match /foo/{bar} {
allow read;
allow write: if doc == "foobar"; // Correct, "doc" is now the document id
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment