Hi all and Happy Holidays,
I'm currently using Firebase on Android along with the Firebase security rules and I'm confused about the implementation of security rules along with the "filter" queries. I keep seeing "rules are not filters" which makes sense when making a broad query
e.g.
A data structure with:
users: {
"user1":{
name: "Leeroy"
},
"user2":{
name: "Jenkins"
}
}
and security rules with:
"users": {
".read": false,
"$userId": {
".read": "data.child('name').val() == 'Leeroy'"
}
}
Database allUsersRef = FirebaseDatabase.getInstance().getReference().child("users");
//this would fail
allUsersRef.addValueEventListener(listener);
//this would succeed
allUsersRef.child("user1").addValueEventListener(listener);
However in my own code USING FILTERS I'm still getting permission errors:
e.g.
Database allUsersRef = FirebaseDatabase.getInstance().getReference().child("users");
allUsersRef.orderByChild("name").equalTo("Leeroy").addValueEventListener(listener); //this is failing
Is this the intended functionality? Will I have to add every single object my users could possibly have access to under a common object even with a filtered query?? I couldn't really find examples of these features together.
Thanks,
Tyler