0
在文檔中,它告訴規則級聯和子級不能撤銷權限,但在稍後的聊天示例中,根讀寫規則默認爲false,爲什麼它不會級聯? Doc link在firebase中將子節點規則cascase作爲子節點及其子節點嗎?
在文檔中,它告訴規則級聯和子級不能撤銷權限,但在稍後的聊天示例中,根讀寫規則默認爲false,爲什麼它不會級聯? Doc link在firebase中將子節點規則cascase作爲子節點及其子節點嗎?
好問題。
當我們說規則級聯時,將其讀取爲權限事例。一旦您有權讀取節點,您就不能在較低級別上獲得該許可。
所以,你可以開始與".read": false
在頂層,然後讓(從Firebase documentation on security rules片斷)讀取下:
{
"rules": {
".read": false,
"room_names": {
// the room names can be enumerated and read
// they cannot be modified since no write rule
// explicitly allows this
".read": true,
但是反過來不行。你不能說一旦你說每個人都可以看到所有的房間名稱,就不允許任何人看到特定的房間名稱:
// THIS SNIPPET WILL NOT WORK
{
"rules": {
".read": false,
"room_names": {
// the room names can be enumerated and read
// they cannot be modified since no write rule
// explicitly allows this
".read": true,
"my_secret_room": {
// THIS WILL NOT WORK
// since we've said that every can read all room names
// we cannot take that permission away anymore
".read": false
}