I'm using Firebase for an app with the following tree structure...
- groups
- $group_id
- users
- $user_id
- users
- $user_id
- groups
- $group_id
Pretty simple - users belong to groups and this relationship is stored both at a 'users' location and a 'groups' location.
I'm looking to write security rules that only allow users to read from other users' Firebase location if they belong to the same group (i.e. if any of their $group_ids match). How should I structure my data in order to ensure this and what does the actual security 'read' rule syntax look like?