Created
June 16, 2018 11:24
-
-
Save adrian-afergon/232153e823660580ee4372ce460b2e4b to your computer and use it in GitHub Desktop.
Definitive rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service cloud.firestore { | |
match /databases/{database}/documents { | |
match /exercises { | |
function getRole(role) { | |
return get(/databases/$(database)/documents/users/$(request.auth.uid)).data.roles[role] | |
} | |
allow read: if getRole('subscriber') == true; | |
allow update: if getRole('editor') == true; | |
allow create, delete: if getRole('admin') == true; | |
} | |
match /{document=**} { | |
allow read, write: if (request.auth.uid != null); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment