Firebase Security Rules Regex in Path

前端 未结 1 952
[愿得一人]
[愿得一人] 2021-01-28 19:49

I have security rule write like this :

 /databases/{database}/documents {

     match /collection_COUNTRY_EN/{docId} {
          allow....
     }

     match /c         


        
相关标签:
1条回答
  • 2021-01-28 20:09

    Security rules do not support regex in the path match. You can only wildcard on the full name of a path segment.

    What you might want to do instead is organize all your common top-level collection into subcollections organized under a known document, and apply the same rules to each of them that way:

    match /countries/data/{countryCollection}/{docId} {
        allow...
    }
    

    This would apply the same permissions to all country subcollections organized under /countries/data, which can be an empty document, or even a non-existent document.

    0 讨论(0)
提交回复
热议问题