Javascript 如何限制用户推送数据或将多个子项添加到firebase数据库子项
在firebase安全规则中,我们如何限制用户将多个数据推送到数据库 我已经试过了,但没用Javascript 如何限制用户推送数据或将多个子项添加到firebase数据库子项,javascript,json,security,firebase,rules,Javascript,Json,Security,Firebase,Rules,在firebase安全规则中,我们如何限制用户将多个数据推送到数据库 我已经试过了,但没用 { "rules": { ".read": false, ".write": false, "voters": { // restrict user to adding child more than one in this path // one user only alowed to add one child ".read": true,
{
"rules": {
".read": false,
".write": false,
"voters": {
// restrict user to adding child more than one in this path
// one user only alowed to add one child
".read": true,
".write": "auth !== null",
".validate": "newData < 2",
"$votersuid": {
".read": true,
".write": "auth.uid == $votersuid",
}
},
}
}
{
“规则”:{
“.read”:错误,
“.write”:false,
“选民”:{
//限制用户在此路径中添加多个子项
//一个用户只允许添加一个子用户
“.read”:正确,
“.write”:“auth!==null”,
“.validate”:“newData<2”,
“$votersuid”:{
“.read”:正确,
“.write”:“auth.uid==$votersuid”,
}
},
}
}
你可以在你的节点上添加一个布尔值,然后你可以这样测试。写:“root.child('node_name')。child('can_write')。val()==true谢谢你的回答,我仍然需要测试它,不幸的是,我不能投票支持你的答案,因为我的声誉还不到15岁。