Skip to content

Instantly share code, notes, and snippets.

@ThadeuLuz
Created September 27, 2017 11:49
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/e8b298f2aae08412bf855dceebcabe3f to your computer and use it in GitHub Desktop.
Save ThadeuLuz/e8b298f2aae08412bf855dceebcabe3f to your computer and use it in GitHub Desktop.
A better stack for your Firebase Rules - Targaryen tests
{
"root": {
"users": {
"RICK": {
"displayName": "Rick Sanchez",
"age": 60
},
"MORTY": {
"displayName": "Morty Smith",
"age": 14
}
}
},
"users": {
"Rick": { "uid": "RICK" },
"Morty": { "uid": "MORTY" },
"Server": { "uid": "SERVER" }
},
"tests": {
"users": {
"canRead": ["Server"],
"cannotRead": ["Rick", "Morty"]
},
"users/MORTY": {
"canRead": ["Server", "Morty"],
"cannotRead": ["Rick"]
},
"users/RICK/age": {
"canWrite": [{ "auth": "Rick", "data": 59 }]
},
"users/RICK/displayName": {
"canWrite": [{ "auth": "Rick", "data": "Pickle Rick" }],
"cannotWrite": [
{ "auth": "Rick", "data": null },
{ "auth": "Rick", "data": 123 },
{ "auth": "Rick", "data": { "no": "object" } }
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment