Google cloud firestore Firestore规则:获取对具有已定义规则的空集合的权限被拒绝
我正在与firestore规则中被拒绝的许可进行斗争,我不明白为什么我会得到这个许可。下面是它是如何发生的: 我在firestore数据库中获得了一个名为Google cloud firestore Firestore规则:获取对具有已定义规则的空集合的权限被拒绝,google-cloud-firestore,permissions,firebase-security,permission-denied,Google Cloud Firestore,Permissions,Firebase Security,Permission Denied,我正在与firestore规则中被拒绝的许可进行斗争,我不明白为什么我会得到这个许可。下面是它是如何发生的: 我在firestore数据库中获得了一个名为investments的集合。目前,此集合中根本没有文档 无论如何,我正在为它编写规则,使用这个简单的示例,使用我的uid作为userId属性获取邀请: rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { mat
investments
的集合。目前,此集合中根本没有文档
无论如何,我正在为它编写规则,使用这个简单的示例,使用我的uid
作为userId
属性获取邀请:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /invitations/{invitationId} {
allow read: if request.auth.uid == resource.data.userId;
}
}
}
当我尝试获取我的收藏时,通过一个只获取带有我的uid
的邀请的特定查询,我从firestore获得了一个权限拒绝错误。即使我的收藏是空的,它也会发生。当我设置条件时,比如允许读取:if true代码>,不再显示错误
我还尝试了这个返回false的条件
allow read: if invitationId == 'idOfMyOnlyInvitation';
或
有人对这个问题有线索吗?提前感谢您的帮助和您的时间。我的问题搞砸了。很抱歉打扰您。我的问题搞砸了。对不起打扰了
allow read: if resource.data.id == 'idOfMyOnlyInvitation';