Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Firebase Blaze编译器给出了不正确的结果_Firebase - Fatal编程技术网

Firebase Blaze编译器给出了不正确的结果

Firebase Blaze编译器给出了不正确的结果,firebase,Firebase,我正在尝试为以下YAML文件编译rules.json: functions: - isLoggedIn(): auth.id !== null schema: type: object properties: projects: type: object $projectId: type: object properties:

我正在尝试为以下YAML文件编译
rules.json

functions:
  - isLoggedIn(): auth.id !== null

schema:
    type: object
    properties:
        projects:
            type: object
            $projectId:
                type: object
                properties:
                    roles:
                        type: object
                        $permissionId:
                            type: object
                            $roleId: {type: boolean}

access:
  - location: /projects/$projectId/
    write: isLoggedIn() && (!next.exists() || next.hasChildren())
当我用blaze编译它时,我得到了以下JSON:

{
  "rules":{
    ".write":"false",
    ".read":"false",
    "projects": {
      ".write":"false",
      ".read":"false",
      "$projectId": {
        ".write":"(((false)))",
        ".read":"false",
        "roles": {
          ".write":"((false))",
          ".read":"false",
          "$permissionId": {
            ".write":"((false))",
            ".read":"false",
            "$roleId": {
              ".write":"(((!newData.parent().parent().parent().parent().parent().exists()||!(((newData.parent().parent().parent().parent().parent().isString()||newData.parent().parent().parent().parent().parent().isNumber()||newData.parent().parent().parent().parent().parent().isBoolean()))))&&(!newData.parent().parent().parent().parent().exists()||!(((newData.parent().parent().parent().parent().isString()||newData.parent().parent().parent().parent().isNumber()||newData.parent().parent().parent().parent().isBoolean()))))&&(!newData.parent().parent().parent().exists()||!(((newData.parent().parent().parent().isString()||newData.parent().parent().parent().isNumber()||newData.parent().parent().parent().isBoolean()))))&&(!newData.parent().parent().exists()||!(((newData.parent().parent().isString()||newData.parent().parent().isNumber()||newData.parent().parent().isBoolean()))))&&(!newData.parent().exists()||!(((newData.parent().isString()||newData.parent().isNumber()||newData.parent().isBoolean()))))&&(!newData.exists()||newData.isBoolean())&&auth.id!==null&&(!newData.parent().parent().parent().exists()||newData.parent().parent().parent().hasChildren())))",
              ".read":"false"
            }
          }
        }
      }
    }
  }
}
我本来希望
$projectId.write
规则包含编译版本的
isLoggedIn()&&(!next.exists()| | next.haschilds())
,但它却包含
((false))


这是blaze中的一个bug还是我的YAML规则构造不正确?如果它不正确,我哪里出错了?

这不是一个错误,而是一些与野生动物筑巢有关的微妙之处。“使用wildchild会阻止所有提升都是可写的。”[1]

您可以通过“~$projectId”在$projectId上使用wilderchild(请注意,出于一些安全考虑,您将无法阻止登录用户删除$permissionId记录[2])

[1]


[2]

我从文档中漏掉了这一点。谢谢你的澄清。
functions:
  - isLoggedIn(): auth.id !== null

schema:
    type: object
    properties:
        projects:
            type: object
            ~$projectId:
                type: object
                properties:
                    roles:
                        type: object
                        $permissionId:
                            type: object
                            $roleId: {type: boolean}

access:
  - location: /projects/$projectId/
    write: isLoggedIn() && (!next.exists() || next.hasChildren())