Skip to content

Instantly share code, notes, and snippets.

@mrbarletta
mrbarletta / FirebaseShareData
Created May 17, 2017 22:31
How to structure Firebase data and rules for sharing data between users
Since the user decides who'd they like to share the list with, I'd store that information in the user data itself. For example:
{
"rules": {
"$userPath": {
".write": "$userPath == 'acc_' + auth.id",
".read": "$userPath == 'acc_' + auth.id || root.child($userPath).child('shared').hasChild(auth.id)"
}
}
}