Security Firebase安全规则保护列表和公共对象

Security Firebase安全规则保护列表和公共对象,security,firebase,firebase-security,Security,Firebase,Firebase Security,我有一个服务器列表,只有在您具有键值时才具有公共访问权限 基本上,若用户有对象密钥,那个么他可以检索完整的子对象。但他不应该被允许访问对象列表 对象的示例 { "servers": { // list of server // list should not be access directly - no anonymous access "key1": { // this object can be access anonymously, if u

我有一个服务器列表,只有在您具有键值时才具有公共访问权限

基本上,若用户有对象密钥,那个么他可以检索完整的子对象。但他不应该被允许访问对象列表

对象的示例

{
    "servers": { // list of server

        // list should not be access directly - no anonymous access

        "key1": {  // this object can be access anonymously, if user knows the key
            "name": "linux"
            //...
        },

        "key2": {
            "name": "ubuntu"
        }
    }
}
如何在firebase中为上述对象制定此类安全规则?

简单:

{
  "rules": {
    ".read": false,
    "servers": {
      "$serverid": {
        ".read": true
      }
    }
  }
}
由于根目录不可读,
/servers
也不可读,只有当您拥有
/servers/$serverid
时,读取操作才会生效


可能我错了,但是我想如果你剥夺了父母的许可,那么你就不能从孩子那里恢复。我会试试看,情况如何。反过来说:一旦你授予了许可,你就不能在较低的级别上取消它。