我正在为我的firestore规则中的一个权限拒绝而苦恼,想不通为什么我会得到这个权限。它是如何发生的。
我有一个名为 invitations
在我的firestore数据库中。现在,这个集合里根本就没有文档。
我正在为它写规则,使用这个简单的例子,用我的 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得到一个权限拒绝的错误。它发生,即使当我的集合是空的。当我设置条件,如 allow read: if true;
,没有更多的错误显示。
我也尝试了这个条件,返回false
allow read: if invitationId == 'idOfMyOnlyInvitation';
或
allow read: if resource.data.id == 'idOfMyOnlyInvitation';
有人知道这个问题的线索吗?先谢谢你的帮助和你的时间。
我的查询被搞砸了。对不起,打扰了。