Parse Server Cloud Code Setting ACL

北城以北 提交于 2019-12-04 19:18:53

I figured it out with the code below. The problem was that I was trying to use the "afterSave" method while trying to adding the ACL to the requested object, however, the ACL should be added before saving, or if it should be done after saving, the object should be retrieved again and then the ACL should be added.

Parse.Cloud.beforeSave('userSetting', function(req, res) {

var acl = new Parse.ACL();
acl.setReadAccess(req.user, true);
acl.setWriteAccess(req.user, true);
req.object.setACL(acl);
res.success();

});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!