There are 2 nodes on Firebase Database, let say "NodeA" and "NodeB" that I want to set permission for.
Node "Users" will contain list of users that use the app, this node can be written to from the app. $userId will be key for each child node
Node "Permission" will contain permission for each user, this node MUST NOT be read or written to by users from the app. $userId is also be a key for each child, with value is 0 as default when users first get into the app.
Let say user1 just get into the app, I call a function to create a new user under "Users" node. And I use firebase functions to write a node with this $userId to "Permission" node.
This user1 can only read "NodeA", NOT "NodeB" until I set Permission.$userId value manually to 1.
How can I setup this rules in Firebase?