I would like to store data under a $user
where some data is readable by the public, and some data is readable only by the user. The security rules would look something like this:
{
"rules": {
"users": {
"$uid": {
"public":{
".read": "auth != null",
},
"private": {
".read": "$uid === auth.uid"
}
}
}
}
}
However, since security rules are not filters, if I were the $user
trying to read at users/$user
, the read would fail, correct? Is there a way to accomplish this or will I always need to perform a read at both users/$user/public
and users/$user/private
when trying to obtain all $user
info for the actual user?
Note that I want to avoid duplicating data in order to reduce the need to keep duplicate data current with the source node, as well as reduce db sanitation when source nodes are deleted. My schema is such that unique keys are the only duplicate data, which always point to a source node as the place to query from.