【发布时间】:2018-11-15 09:59:07
【问题描述】:
我需要为一个名为“测试用例”的子集合创建一个 Firestore 规则。由于firestore规则不是用javascript编写的,我似乎无法在匹配后获得路径来接受空格而不会出错。
我尝试了引号、转义字符的反斜杠以及将整个路径放在引号中。我在firestore文档或堆栈溢出中没有找到任何相关内容。
如何在匹配后的路径中允许空格,在下面的示例中,在包含“测试用例”的路径中?
service cloud.firestore {
match /databases/{database}/documents {
match /companies/{company} {
allow read: if getUserCompany() == company || userHasAnyRole(['Super', 'Manager']);
allow write: if getUserCompany() == company || userHasAnyRole(['Super', 'Manager']);
match /Test Cases/{tests} {
allow read, write: if isSignedIn();
}
}
【问题讨论】:
-
路径中真的可以有空格吗?
-
是的,它在其他地方运行良好。我有一些文件的名字来自有空格的客户,当作为通配符传递时它们工作正常。只是当我需要指定具体路径的时候我有问题。
标签: firebase firebase-authentication google-cloud-firestore firebase-security