2014-12-22 2 views
1

나는 다음과 같은 Blaze 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()) 

나는 다음과 같은 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" 
      } 
      } 
     } 
     } 
    } 
    } 
} 

I을 $projectId.write 규칙에 isLoggedIn() && (!next.exists() || next.hasChildren())의 컴파일 된 버전이 포함될 것으로 예상되었지만 대신 (((false)))을 포함합니다.

이 버그는 불길에 있습니까? 아니면 YAML 규칙이 올바르게 작성되지 않았습니까? 맞지 않으면 어디서 잘못 읽었습니까?

답변

0

버그는 아니지만 와일드 타일의 중첩과 관련된 약간의 미묘함. "wildchild를 사용하면 모든 ascendents가 쓰기가 불가능합니다." [1]

"~ $ projectId"에 의해 $ projectId 대신 wilderchild를 사용할 수 있습니다 (몇 가지 보안 고려 사항이 포함되어 있으므로 로그인 된 사용자가 $ permissionId 레코드를 삭제할 수 없습니다 [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()) 

[1] https://github.com/firebase/blaze_compiler#wildchild

[2] https://github.com/firebase/blaze_compiler#wilderchild

+0

I이 문서에서 그 점 놓쳤다. 해명 해줘서 고마워. –