I\'m trying to create a rule in Firestore that restricts usage to all CRUD operations for users that belongs to a specific domain, My issue is that seems like contains claus
request.auth.token.email
is going to be a String, and according to the reference docs, String doesn't have a method called "contains". It does have a method called matches for using regular expressions, and you can see the documentation has a handy bit of sample code:
'user@domain.com'.matches('.*@domain[.]com') == true
Which you should be able to adapt to your case:
return request.auth != null && request.auth.token.email.matches('.*@domain[.]com')