【发布时间】:2019-02-24 20:28:59
【问题描述】:
我目前是第一次使用 Firestore,并尝试稍微了解一下安全规则。我现在的问题很简单,我可以通过做更多的研究找到答案,但我想确保我做的是正确的事情,所以我认为在这里问会更好。
如果我在 Firestore 中有两个集合,一个名为“A”,另一个名为“B”,如果我只想让经过身份验证的用户在 A 和每个人中读取、写入、更新、删除...在 B 中读取,但只是经过身份验证的用户在 B 中写入、更新、删除...。
编辑: 以下是他们将 B 的规则应用于所有集合的当前规则:
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read: if true;
allow write: if request.auth.uid != null;
}
}
}
【问题讨论】:
-
请把 Firestore 规则放到帖子里。 (我在我的手机上,所以更容易直接从这里阅读),我会尽力帮助你。 :)
-
firebase.google.com/docs/firestore/security/rules-structure - 以下是您如何构建它的方法。使用“match /{}”类似这样的东西:match / {B}
标签: firebase firebase-authentication google-cloud-firestore firebase-security