【发布时间】:2021-01-20 09:09:52
【问题描述】:
我希望用户能够读取和删除他们受邀创建记录的人在 Firebase 上创建的记录。
创建的记录有一个字段“resource.data.ownerUid”,其中 ownerId 是邀请其他人创建记录的用户的 uid。
如果我尝试类似:
allow read, delete: if request.auth.uid == resource.data.ownerUid;
但我在“获取”步骤中被拒绝:
firestore.collection('screeningResponses')
.where('screeningId', '==', screeningId)
.get()
结果
FirebaseError: Missing or insufficient permissions.
那时我正计划遍历 QuerySnapshot 并删除记录,但无法做到这一点。有什么建议吗?
【问题讨论】:
标签: javascript google-cloud-firestore firebase-security