There are many posts about firebase realtime rule but I still cannot solve my problems.
This is my data. There may be multiple "GId" or multiple "User" or multiple "caregiver".
I want to grant access to "GId" if a specific value exists in "caregiver". My following rule does not work.
{
"rules": {
"GId": {
"$GId": {
".write": "data.child('User').child('caregiver').child('-N0Uy6K55bQlkPuuoioA').exists() ",
".read": "data.child('User').child('caregiver').child('-N0Uy6K55bQlkPuuoioA').exists()",
}
}
}
}
But if I change the rule to grant access to "GId" if a specific value exists in "User", it works. Could you please show me what is wrong with my first rule?
Is it possible to grant other "GId" access to only some "User" in another "GId"?
{
"rules": {
"GId": {
"$GId": {
".write": "data.child('User').child('6e42092aa73f47f48657fe7f3a9610c5').exists() ",
".read": "data.child('User').child('6e42092aa73f47f48657fe7f3a9610c5').exists() ",
}
}
}
}