Dan*_*ein 1 firebase-security google-cloud-firestore
我正在尝试实施此处概述的规则:https : //stackoverflow.com/a/56047977/1604072
match /{path=**}/posts/{post} {
allow read: if request.auth.uid != null;
}
Run Code Online (Sandbox Code Playgroud)
这会产生此错误:无效的 glob 匹配表达式。全局匹配被允许作为匹配声明路径中的最后一段。
这是现在写这个的唯一/正确的方法吗?:
match /{path=**}{
match /collectionItems/{collectionItem} {
allow read: if request.auth.uid != null;
}
}
Run Code Online (Sandbox Code Playgroud)
对于未来的用户,刚刚找到了这一点文档。不知道为什么我最初找不到它:
基于集合组保护和查询文档
在您的安全规则中,您必须通过为集合组编写规则来明确允许集合组查询:
- 确保
rules_version = '2';是规则集的第一行。集合组查询需要安全规则版本 2的新递归通配符{name=**}行为。- 使用 为您的集合组编写规则
match /{path=**}/[COLLECTION_ID]/{doc}。
| 归档时间: |
|
| 查看次数: |
565 次 |
| 最近记录: |