1
這是我的規則:Firebase規則權限被拒絕,但爲什麼?
{
"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時,它會起作用。
謝謝。