似乎无论我做什么,Public角色总是具有对User对象的读访问权。我看到公共(读)和用户(读/写)的ACL。
以下代码应该仅限制对用户的访问。如何防止Public对新User对象具有读取权限?
PFACL *defaultACL = [PFACL ACL];
[defaultACL setPublicReadAccess:NO];
[PFACL setDefaultACL:defaultACL withAccessForCurrentUser:YES];
PFUser *user = [PFUser user];
user.username = username;
user.password = password;
[user signUpInBackgroundWithBlock:^(BOOL succeeded, NSError *error) { ...
答案 0 :(得分:1)
限制公共访问时,您的记录最终会在User表中显示私有读/写访问权限。只需在云代码的用户beforeSave
触发器中添加以下代码:
Parse.Cloud.beforeSave(Parse.User, function(request, response) {
// When creating a new user record
if(request.object.isNew()) {
var privateACL = new Parse.ACL();
privateACL.setPublicReadAccess(false);
request.object.setACL(privateACL);
// other stuff
}
});