I am pretty confused about the Firebase security rules - about WORK FROM THE TOP-DOWN as the docs.
So I have this rule:
"rules": {
"taskUsers": {
".read": "auth != null",
"$uid": {
".read": "auth != null",
".write": "auth != null && auth.uid == $uid",
},
},
}
So all the user data can only be updated by the user who created them b/c of auth.uid == $uid. But under the firebasepath/taskUsers/$uid, I have a value called notification that I want other users can able to write. Like in a chat notification system - when other users contact this user, the "other users" can change / write the value notification (like +1). But with the above rule, "other users" when they post the contact, it will return permission denied. So if I do the rule like
"rules": {
"taskUsers": {
".read": "auth != null",
"$uid": {
".read": "auth != null",
".write": "auth != null && auth.uid == $uid",
"notification": {
".write": "auth != null",
},
},
},
}
The rule got ignored...So how can I create a rule just allow notification value under the taskUsers/$uid to be written by everyone who login?