【发布时间】:2018-04-21 03:51:14
【问题描述】:
我是 Firebase 的新手。我正在尝试设置规则,并且我正在使用此规则来让只有用户评论所有者才能编写。问题是它需要发布者 ID(所有者 ID),但是当我尝试删除节点时它不起作用,因为我无法发送发布者 ID(可以吗?)。这是规则:
"infinity_comments":{
"country": {
"$countryid": {
"$postid": {
"$pushid": {
".write": "(!data.exists() && newData.child('posterid').val() == auth.uid ) || (data.child('posterid').val() == auth.uid && newData.child('posterid').val() == auth.uid)"
}
}
}
}
},
这就是我尝试删除评论的方式:
firebase.database().ref('infinity_comments/country/countryid/postid/pushid/').remove(function(error){
if (!error) {
alert('success');
}
else {
alert(error)
}
})
我收到权限被拒绝错误。
【问题讨论】:
标签: javascript firebase firebase-realtime-database firebase-security