javascript - 创建解析角色层次结构失败并显示 'parent is undefined'

标签 javascript node.js parse-platform roles

Parse 中设置 Angular 色层次结构时出现奇怪的错误:

Uncaught ReferenceError: parent is not defined

Angular 色在 Parse 中都创建正常,并且我从 getRoles 获得的关系对象看起来不错,但是当调用 add 方法时,我收到此错误。还有人遇到过类似的事情吗?

这是代码(运行 parse@1.6.3,parse/node 实现):

function createRolesForOrganization(organization){
  var self = Parse.User.current();
  var ownerRole = new Parse.Role(organization.id + '_Owner', new Parse.ACL(self)),
      adminRole = new Parse.Role(organization.id + '_Admin', new Parse.ACL(self)),
      userRole = new Parse.Role(organization.id + '_User', new Parse.ACL(self));

  return Parse.Object
    .saveAll([
      ownerRole, 
      adminRole, 
      userRole
    ])
    .then(function(objs){
      ownerRole = objs[0];          
      adminRole = objs[1];
      userRole = objs[2];

      userRole.getRoles().add(adminRole);
      adminRole.getRoles().add(ownerRole);

      return Parse.Object.saveAll([
        ownerRole, 
        adminRole, 
        userRole
      ]);
    });
}

最佳答案

这是 Parse JavaScript SDK 中的一个错误,报告如下: https://developers.facebook.com/bugs/1677477152487599/

同时,一个快速修复方法是在 ParseRelation.js 中将第 101 行的“parent”替换为“this.parent”,或者回滚到 1.6 之前的版本。

关于javascript - 创建解析角色层次结构失败并显示 'parent is undefined',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32614242/

相关文章:

javascript - Model.Isvalid 在我的 MVC 4 应用程序中失败。如何解决这个问题?

javascript - 添加新的 Meteor CollectionFS 存储

javascript - Node.js 脚本未完成就停止且没有声音

iOS parse.com 推送错误

javascript - 表单验证循环检查所有文本并选择非空

javascript - Stage.addchild 将对象置于前面

javascript - NodeJS MongoDB 动态查询

node.js - 获取 MongoDB 嵌入式集合文档

ios - 如何为解析类建模以包含 isliked、isfollowing 字段以及 PFQuery 结果

android - Android 的 ParseQueryAdapter 不调用其 onLoaded 方法