【发布时间】:2018-06-05 02:37:19
【问题描述】:
我有以下 Firestore 规则:
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read: if true;
}
match /institutions/{institution}/watches/{watch} {
allow read, update, delete: if request.auth.email == resource.data.email;
allow create: if request.auth.email != null;
}
}
}
基本上,我希望/institutions/{institution}/watches 下的任何文档都可以读取/更新/删除当且仅当文档上的电子邮件与用户的电子邮件相同时。但是,当我使用示例文档通过模拟器运行此操作时,我无法使访问控制工作,并且我还在 API 客户端上收到权限被拒绝错误。
有什么方法可以进一步调试/我的上述规则中缺少什么吗?
【问题讨论】:
-
我认为
allow read: if true;如果布尔值?不知道你能不能像if true那样做 -
@RonRoyston
if true在 Firestore 安全规则中正确使用。您可以查看the docs 了解更多信息:)
标签: firebase google-cloud-firestore firebase-security