Skip to content

Instantly share code, notes, and snippets.

@heloa-net
Last active January 7, 2017 23:55
Show Gist options
  • Save heloa-net/68bed8db34cc89f5db3fc8d6c7f9655d to your computer and use it in GitHub Desktop.
Save heloa-net/68bed8db34cc89f5db3fc8d6c7f9655d to your computer and use it in GitHub Desktop.
Firebase db rules for social app with profiles and posts
{
"rules": {
".read": true,
"profiles": {
"$user_id": {
".read": true,
".write": "$user_id === auth.uid"
}
},
"posts": {
"$post": {
".read": true,
".write": "!data.exists() && newData.child('userId').val() === auth.uid"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment