firebase - 尝试为 HashMap 引入 Firestore 安全规则并相互同步查询
问题描述
在创建一些 Firestore 安全规则以处理我的代码中的查询时,我需要帮助。所以我尝试使用 HashMap,如下所示,“sharedWith”是我文档中的一个 hashmap 字段:
...
sharedWith
abc@gmail.com : true
zzz@gmail.com : true
...
我的安全规则我尝试设置如下:
allow read: if isSignedIn() && resource.data.sharedWith[request.auth.token.email]=="true"
我期望发生的是当用户“zzz”登录时,该用户应该能够阅读此文档(由其他用户创建)
我的查询如下:
db.collection("Sites")
.whereEqualTo("sharedWith."+"zzz.@gmail.com",true)
.get()
.addOnSuccessListener { result -> ...
请问我哪里错了?
我得到的错误如下:
侦听查询(sharedWith..com
zzz@gmail
== true order by name的站点)失败:状态{code=PERMISSION_DENIED,description=Missing 或权限不足。,cause=null}
解决方案
推荐阅读
- ios - 下面有一个或多个错误验证 - Testflight
- tomcat - 将tomcat webapp从服务器移动到本地主机
- apache-kafka - 如何跟踪主题中两个事件之间的变化?
- android - 使用 recyclerView 生成带有折叠单元库的列表
- arraylist - 复制文件后找不到路径
- python - 安装时出现“importError: cannot import name 'main'”错误
- python - Python:按间隔对csv文件进行排序
- vb.net - 使用 ClosedXML 在现有 Excel 工作表中嵌入对象
- jquery - 无法在 jQuery 中将数组元素添加到表格行
- python - 使用 python skpy 连接到Skype