使用以下代码,我能够成功创建一个 Parse.Object,并在数据浏览器中查看它:
// This code executes correctly:
var UPrefs = Parse.Object.extend("uPrefs");
var uPrefs = new UPrefs();
uPrefs.setACL(new Parse.ACL(Parse.User.current()));
uPrefs.save();
promise 完成后,当前用户不能再更新对象:
// But then this code throws a 403 error
uPrefs.save();
错误详情如下:
code: 119
"This user is not allowed to perform the update operation on uPrefs. You can
change this setting in the Data Browser."
即使数据浏览器向创建它的用户显示行集的 ACL(具有读写权限),然后尝试更新它。
谁能发现我做错了什么?
非常感谢您的帮助!
最佳答案
感谢 WandMaker 的评论引导我朝着正确的方向前进:
为了解决这个问题,我需要:
- 将 user
列添加到 uPrefs
Parse.Object 模型。
- 在类级别权限中添加指向user
列的指针,并将其设置为具有读取/创建/写入/更新/销毁权限。
一旦完成,下面的代码就可以工作了:
var UPrefs = Parse.Object.extend("uPrefs");
var uPrefs = new UPrefs();
uPrefs.set("user", Parse.User.current());
uPrefs.setACL(new Parse.ACL(Parse.User.current()));
uPrefs.save();
然后所有 future 的 save()
调用也能正常工作。
关于javascript - 为什么我不能将 save() 保存到这个 Parse.Object?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31629457/