我正在使用Parse,我有大约500个用户。我刚刚遇到一个新问题,其中只有一些用户拥有他们的ACL集,并且在查询时找不到它们。基本上,我无法访问任何拥有ACL集的用户。有任何想法吗?谢谢!
答案 0 :(得分:0)
尝试在Parse应用程序的云代码(javascript)中创建自定义函数或后台作业,并尝试执行以下操作:
// bypass ACL restriction
Parse.Cloud.useMasterKey();
// take an user for test, fetch it
var someFetchedUser = ......;
// creating new acl object
var newACL = new Parse.ACL();
// define public read access on this acl object ( means: all users can read the owner row
// that will keep this acl ( so the someFetchedUser )
newACL.setPublicReadAccess(true);
// define possibility to write / delete just to this user ( so, the owner user himself )
newACL.setWriteAccess(someFetchedUser.id,true);
// set the new ACL to the fetched user ( overwrite previous one )
someFetchedUser.setAcl(newACL);
// apply modification ( should works since you're working with masterkey from the scratch )
someFetchedUser.save().then(function(savedUser){
// Do your stuff..
},function(err){
// Damn!!!! something was wrong....
});
它应该更改用户的ACL(根据需要进行更改以将其应用于所有用户)
希望它有所帮助!