我不明白为什么我会获得以下代码的权限拒绝错误。
stream = FirebaseFirestore.instance
.collection('events')
.doc(widget.event.id)
.collection('invitations')
.snapshots();
match /events/{eventId} {
match /invitations/{email} {
allow read: if
request.auth.token.email == email ||
request.auth.token.email == get(/databases/$(database)/documents/events/$(eventId)).data.user_id;
}
}
request.auth.token.email
或其他文档中的字段。
FireBase安全规则不是过滤的(您应该阅读此文档并了解其在说什么)。 规则不会查看每个文档,并确定用户可能会找到哪些文档。 规则要求“查询请求”仅限规则允许的特定文档,这意味着您应该仅代码get()
一个符合规则要求的单个文档。