Firebase 在Firestore规则中使用resource.data

Firebase 在Firestore规则中使用resource.data,firebase,google-cloud-firestore,firebase-security,Firebase,Google Cloud Firestore,Firebase Security,我有以下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.au

我有以下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}/watchs
下的任何文档都是可读/更新/删除的,只要文档上的电子邮件与用户的电子邮件相同。然而,当我使用一个示例文档在模拟器中运行它时,我无法使访问控制工作,并且在API客户机上也出现了一个权限拒绝错误


有没有办法进一步调试这个问题/我的上述规则中缺少了什么?

我认为
request.auth.email
应该是
request.auth.token.email
。请参阅。

我认为
允许读取:如果为真如果布尔?如果为true,则不确定是否可以执行that@RonRoyston
如果为true,则在firestore安全规则中正确使用。您可以查看以了解更多信息:)