Skip to content

Instantly share code, notes, and snippets.

@breadplop
Last active December 14, 2018 17:13
Show Gist options
  • Save breadplop/4c76828a9efb4b5067bb8389846ba71f to your computer and use it in GitHub Desktop.
Save breadplop/4c76828a9efb4b5067bb8389846ba71f to your computer and use it in GitHub Desktop.
{
"rules": {
"reviewsLogin": {
".read": true,
".write": true
},
"reviews": {
".read": true,
".write": true
},
"reviewsSecure": {
".read": true,
".write":true,
"$reviews_secure_id": {
".read": true,
".write": "auth.uid == root.child('reviewsSecure').child($reviews_secure_id).child('user_id').val()"
}
}
}
}
@breadplop
Copy link
Author

To only read user's data (disallow user to view his/her friend's data)

Change rules to:

"reviewsSecure": {
      ".read": true,
      "$reviews_secure_id": {
      	".read": "auth.uid === root.child('reviewsSecure').child($reviews_secure_id).child('user_id').val()",
        ".write": "auth.uid === root.child('reviewsSecure').child($reviews_secure_id).child('user_id').val()"
      }
    }```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment