【发布时间】:2021-07-28 16:42:34
【问题描述】:
假设我有一个“报价”文档,其中保存了原始创建者的 uid 作为一个名为“uid”的字段。
如何修改以下规则以仅允许 request.auth.uid 与文档字段中匹配的用户更新文档?
这是我现在的规则
function signedInOrPublic() {
return request.auth.uid != null;
}
match /offer/{offerDcoument} {
allow read: if request.auth.uid != null
allow create: if signedInOrPublic()
allow update: <ONLY ALLOW IF THE UID FIELD MATCHES request.auth.uid CONDITION>
}
【问题讨论】:
标签: firebase google-cloud-firestore firebase-security