这些规则的格式是否正确?当我将它们放入数据库规则时,我看到红色虚线表示错误/警告,但是当我将鼠标悬停在它上面时,我没有收到任何反馈。
{
"rules": {
"users": {
"$uid": {
// grants write access to the owner of this user account whose uid must exactly match the key ($uid)
".write": "auth !== null && auth.uid === $uid",
// grants read access to any user who is logged in --&& auth.provider === 'password'
".read": "auth !== null"
}
},
"usernames": {
"$userName": {
// grants write access to the owner of this user account whose uid must exactly match the key ($uid)
".write": "root.child('usernames').child($userName).child('uid').val() == auth.uid || root.child('usernames').child($userName).child('uid').val() == null",
// grants read access to any user who is logged in --&& auth.provider === 'password'
".read": "auth !== null"
}
},
"following": {
"$uid": {
// grants write access to the owner of this user account whose uid must exactly match the key ($uid)
".write": "auth !== null && auth.uid === $uid",
// grants read access to any user who is logged in --&& auth.provider === 'password'
".read": "auth !== null"
}
},
"followedBy": {
"$fid": {
"$uid": {
// grants write access to the owner of this user account whose uid must exactly match the key ($uid)
".write": "auth !== null && auth.uid === $uid",
// grants read access to any user who is logged in --&& auth.provider === 'password'
".read": "auth !== null"
}
}
}
}
}
答案 0 :(得分:1)
我也见过这些。差不多,只要我添加一个空行。
我认为空行只会导致出现错误的错误指示。
既然什么都没有失败(至少对我来说不是我能看到的),我不会担心它们。
答案 1 :(得分:0)
重新格式化代码规则并使之可读 只需复制您的规则,然后转到JS cleaner,然后单击鼠标即可将其复制并粘贴到您的数据库规则中