I'm building a chat app with Firestore and each chat room has a map of participants like so:
The keys are the corresponding UIDs of the users. I want to use this map to decide which user can access a chat. In my security rules, I currently check if the logged-in user's UID exists in this map to allow read and write access:
allow read, write: if request.auth.uid in resource.data.participants
But this only checks if the user is in this map, not if the value is actually true. I want to check that as well.
What I basically want is something like this:
allow read, write: if resource.data.participants.request.auth.uid == true
But this does not actually work. How do I use the current user's UID as the key in a map check?