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