解析服务器云代码无法创建角色 [英] Parse-Server cloud code can't create Role

查看:107
本文介绍了解析服务器云代码无法创建角色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为Project的类,我为其创建一个Parse.Role以获取读/写权限.

I have a class called Project for which I create a Parse.Role for read/write permissions.

这是我创建角色的方式:

Here's how I create my Role:

var roleName = "hasSound_" + ident;
var projectRole = new Parse.Role(roleName, new Parse.ACL());
projectRole.getUsers().add(creator); 

return projectRole.save().then(function(role) {

var acl = new Parse.ACL();
acl.setReadAccess(role, true); //give read access to Role
acl.setWriteAccess(role, true); //give write access to Role

project.setACL(acl);            
project.save();

});

这是我尝试创建Parse.Role时遇到的错误请求:

And here's the bad request I'm getting when trying to create the Parse.Role:

Mar 04 14:39:32 ancient-lake-41070 heroku/router:  at=info method=POST path="/parse/classes/_Role" host=ancient-lake-41070.herokuapp.com request_id=82af3849-842a-406f-8a4b-5f573e08a1e1 fwd="54.145.36.110" dyno=web.1 connect=0ms service=6ms status=400 bytes=578

推荐答案

显然,我需要在所有保存功能中添加useMasterKey.在.save()函数中,它是第二个参数,如下所示:obj.save(null, {useMasterKey: true})

So apparently I needed to add useMasterKey to all my save functions. In a .save() function it is the second parameter, like so: obj.save(null, {useMasterKey: true})

一旦这样做,就创建了角色,我的所有关系都重新开始,依此类推.

Once I did that, the Role was created, all my relations are working again, etc.

有关更多信息,请参见此处: https://github.com/ParsePlatform/parse-服务器/问题/37

See here for more info: https://github.com/ParsePlatform/parse-server/issues/37

这篇关于解析服务器云代码无法创建角色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆