我是Firebase的新手,我对安全规则感到困惑。我有一个像这样的在线用户数据库:
USER_ONLINE_STATUS:
---- channelOneId (dynamic)
---- user1Id (dynamic): "ONLINE"
---- user2Id (dynamic): "AWAY"
---- channelTwoId (dynamic)
---- user1Id (dynamic): "OFFLINE"
---- user2Id (dynamic): "ONLINE"
我尝试的是-
{
"rules": {
"USER_ONLINE_STATUS": {
"$channelId": {
".read": "true",
"$user_id": {
".write": "auth.uid === $user_id",
".validate": "newData.isString() && newData.val().length > 0 && newData.val().length < 20"
}
}
}
}
}
但这给我设置了/ USER_ONLINE_STATUS / c5ba55dfc11557daaaf7ppllmm34 / 5ecfa107wpwpwpwp393f78f024失败的错误:Permission_denied