I'm trying to have a data structure like this and to ensure that a user can only pull in their own data, since all the processing is done client side.
What database security rules would I have to use so that User1 can access their own posts, but cannot access User2's posts?
(I'm using Firebase web)
Sample database structure:
{
"posts" : {
"001" : {
"text" : "note 1",
"userID" : "User1"
},
"002" : {
"text" : "note 2",
"userID" : "User1"
},
"003" : {
"text" : "note 3",
"userID" : "User2"
}
}
}
Sample database query:
firebase.database().ref('/posts/').once('value').then(function(snapshot) {
console.log(snapshot.val()); // Returns all 3 posts
});