【发布时间】:2019-12-19 01:15:17
【问题描述】:
我有一个事件文档,其中包含标题、位置、容量、坐标等字段。我想设置允许更新文档的安全规则,但如果用户尝试更改容量字段,则会拒绝该请求
那么如何编写这样的安全规则呢?我可以这样做吗?
service cloud.firestore {
function admin() {
return get(/databases/$(database)/documents/users/$(request.auth.uid)).data.admin == true
}
match /databases/{database}/documents {
match /events/{eventId} {
allow update: if // (allow if user not trying to update capacity field) ???
}
}
}
【问题讨论】:
标签: firebase google-cloud-firestore firebase-security