Dynamic Firestore rules ?
I have 2 collections and I control access but granting customClaim. Now if I have more and more collections rules will become long.
Example
service cloud.firestore { match /databases/{database}/documents { match /india/{documentID} { allow read, write : if request.auth.token.india_admin == true allow read : if true } } match /databases/{database}/documents { match /japan/{documentID} { allow read, write : if request.auth.token.japan_admin == true allow read : if true } } }
Is there a way I can generalize it by using collection name variable
request.auth.token
is a Map. I don't see a way to look up a key with concatenated string in there. – Frank van Puffelen