All of the examples show securing Firebase Database with a single user. In my application, I have several Firebase Auth users who are grouped into an account. All of the users on the account should have access to read/write to nodes grouped under the account id.
Here's a sample of how it is structured:
- users
- [user id1]
- [user id2]
- [user id3]
- accounts
- [account id1]
- [user id1]
- [user id2]
- [account id2]
- [user id3]
- things
- [account id1]
- thing 1
- thing 2
- [account id2]
- thing 3
- thing 4
I want only users who are a part of an account to be able to read/write "things" within their own account node. So [user id1] and [user id2] should be able to read/write only "things" within the [account id1] node. Is this possible with the Firebase Database rules?