0
我被困在Firebase安全規則中。我不明白它如何將「url」映射到$variable
。Firebase身份驗證映射到用戶特定的路由
這兩個圖是如何映射的?
"$user": {
".read": "$user == 42" // where does this $user get its value from?
}
鑑於此規則集:
{
"rules": {
"users": {
"$provider": {
"$user": {
".read": "$user == auth.id",
".write": "$user == auth.id",
}
}
}
}
}
不起作用:
Attempt to read /users/twitter/169508069 with auth={"id":169508069}
/
/users
/users/twitter
/users/twitter/169508069: "$user == auth.id"
=> false
No .read rule allowed the operation.
Read was denied.
作品:基於(改變規則,以固定的用戶ID)
Attempt to read /users/twitter/169508069 with auth={"id":169508069}
/
/users
/users/twitter
/users/twitter/169508069: "169508069 == auth.id"
=> true
Read was allowed.
的文檔0,它看起來像我從$user
到".read": "$user == auth.id"
的映射是正確的,但我必須錯過一些東西。
您也可以在客戶端上使用debug:true來創建一個登錄標記(http://jsfiddle.net/katowulf/D4YL8/embedded/result/),以便在客戶端查看與模擬器相似的輸出。 – Kato