【问题标题】:Setting rule for a new collection为新集合设置规则
【发布时间】:2021-10-22 14:07:18
【问题描述】:

以下代码中的第二条和第三条规则按预期工作。我正在尝试指定mailingList 集合的访问条件以允许任何人写入。但是,这始终是阻塞的。

service cloud.firestore {
  match /databases/{database}/documents {
    
    match /malingList/{doc} {
        allow write: if true; 
    }
    match /metadata/{doc} {
        allow read: if request.auth.uid != null; 
    }
    match /taken/{doc}{
      allow read: if request.auth.uid != null;
      allow read,write: if
          request.auth.uid == doc;
    }
  }
}

【问题讨论】:

  • "这总是阻塞" => 在哪个上下文中?你能分享用于写入这个集合的代码吗?

标签: firebase google-cloud-firestore firebase-security


【解决方案1】:

看来你打错了:

规则 => match /malingList/{doc} {} 没有 ial 之间

但您想写入mailingList 集合。

【讨论】:

  • 哇.. 我是个白痴。感谢和抱歉给您带来的麻烦
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多