【发布时间】:2017-09-13 22:48:05
【问题描述】:
这是我的规则:
{
"rules": {
"freecoinsrequest":{
".read": false,
".write": "
newData.child('uid').val() == auth.uid
1. && (root.child('users').child(auth.uid).child('/server/lasttimetookfreecoins').val() < now - 10000
2. || !root.child('users').child(auth.uid).child('/server/lasttimetookfreecoins').exists())
" ,
"uid":{
".validate" : true
},
"$other":{
".write": false,
".validate": false
}
},
}
}
因此,只有在以下情况下,用户才能写入路径:
- JSON 包含“uid”作为键,他的 uid 作为值
- 他没有在 10 秒前写入服务器/lasttimetookfreecoins 或
- 他从未写信给服务器/lasttimetookfreecoins
我不明白为什么它在模拟器中被拒绝。当我取消注释 1 和 2 时,如规则中所示,它有效。
谢谢。
【问题讨论】:
标签: firebase firebase-realtime-database firebase-security