【发布时间】:2019-01-27 07:53:51
【问题描述】:
我正在尝试将 Firebase 的规则通配符与子比较混合。
我在其他地方读到一个值为“4”的孩子。
当我进行字面比较时,模拟器给了我绿灯(像这样):
{
"rules": {
"die": {
"rolls": {
"$i": {
".read": "4 == root.child('die/i').val()"
}
},
"i": {
".read": true,
".write": true
}
}
}
}
输出(成功):
Type read
Location /die/rolls/4
Data null
Auth null
Read successful
Line 7 (/die/rolls/4)
read: "4 == root.child('die/i').val()"
但是通配符比较失败。为什么?
{
"rules": {
"die": {
"rolls": {
"$i": {
".read": "$i == root.child('die/i').val()"
}
},
"i": {
".read": true,
".write": true
}
}
}
}
输出(失败):
Type read
Location /die/rolls/4
Data null
Auth null
Read denied
Line 7 (/die/rolls/4)
read: "$i == root.child('die/i').val()"
(另外,我尝试过模拟身份验证;同样的事情。)
【问题讨论】:
-
将其转换为文本并给出了我能给出的错误/日志。谢谢
-
感谢! (我无法回答你的实际问题,但祝你好运)
-
Alex,如果@Padawan 的回答没问题,你真的应该选择它。
标签: firebase firebase-realtime-database real-time wildcard firebase-security