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.

Revisions

  1. SUPERCILEX created this gist Oct 4, 2017.
    22 changes: 22 additions & 0 deletions variables.rules
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    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
    }
    }
    }
    }