My database structure is:
root
|_users
|_ user0
|_ user1 x
|_ user2
|_ . . .
I want to deny data read for user1 only.
Means, read with following paths should NOT be denied :
/
/users
/users/user0
/users/user2
I tried this out, but it will not work on data read with /users path
{
"rules": {
"$allreferences": {
".read":true,
},
"users": {
"$allusers": {
".read":" $allusers !== "user1" "
}
}
}
}
2
Answers
try to use this code
You can use a combination of a named rule and a wildcard rule for this:
Note though that you now won’t be able to read directly from
/users
and will instead have to read each individual user node. This is because any permission you grant on/users
would cascade downwards to all child nodes, and there’s no way to implement an exception to this rule.