Skip to content

Instantly share code, notes, and snippets.

@ThadeuLuz
Created September 26, 2017 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThadeuLuz/13f5c1e582b4d71fd6be74e31a534b18 to your computer and use it in GitHub Desktop.
Save ThadeuLuz/13f5c1e582b4d71fd6be74e31a534b18 to your computer and use it in GitHub Desktop.
A better stack for your Firebase Rules - Compiled Rules
{
"rules": {
"users": {
".read": "auth != null && auth.uid == 'SERVER'",
"$userId": {
".validate": "newData.hasChildren(['displayName', 'age'])",
"displayName": {
".validate": "newData.isString()"
},
"age": {
".validate": "newData.isNumber()"
},
"$other": {
".validate": "false"
},
".read": "auth != null && auth.uid == $userId",
".write": "auth != null && auth.uid == $userId || auth != null && auth.uid == 'SERVER'"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment