Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/111.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 将新用户对象的读/写访问权限仅限于该用户?_Ios_Objective C_Parse Platform - Fatal编程技术网

Ios 将新用户对象的读/写访问权限仅限于该用户?

Ios 将新用户对象的读/写访问权限仅限于该用户?,ios,objective-c,parse-platform,Ios,Objective C,Parse Platform,似乎无论我做什么,公共角色始终具有对用户对象的读取权限。我看到一个用于Public(读)和用户(读/写)的ACL 下面的代码应该只限制用户访问。如何防止Public具有对新用户对象的读取权限 PFACL *defaultACL = [PFACL ACL]; [defaultACL setPublicReadAccess:NO]; [PFACL setDefaultACL:defaultACL withAccessForCurrentUser:YES]; PFUser *user = [PFUs

似乎无论我做什么,公共角色始终具有对用户对象的读取权限。我看到一个用于Public(读)和用户(读/写)的ACL

下面的代码应该只限制用户访问。如何防止Public具有对新用户对象的读取权限

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) { ...

当您限制公共访问时,您的记录最终在用户表中具有私有读/写访问权限。只需在您的用户
中添加以下代码,然后在云代码中保存
触发器:

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
    }

});

因此,当您创建ACL时,您最初没有当前用户?啊,这是个好问题,但我仍然想知道,尽管我的CLP只允许创建操作,为什么Public始终具有新用户对象的读取权限?我发现最接近答案的是,但这仍然让我不安地看到具有读访问权限的公共服务。无论如何,我通常会为此添加一个on-save-cloud代码钩子