Search code examples
iosaclparse-platform

Parse for iOS : ACL for more than one user


Can more than one user have access to a PFObject? And how do I do that? I am on iOS, and want a PFObject to be accessible by 2 or more PFUsers.

I checked the functions:

PFACL *acl = [PFACL ACLwithUser:somePFUser]
[PFACL setDefaultACL:defaultACL withAccessForCurrentUser:YES];

The second function is of no use for me, because that is for "all" PFObjects created on my device. However, I want to control the acl's on object by object basis. Can we do that? THanks!

I am doing this:

PFObject *newObj = [PFObject objectWithClassName:KEY_CLASSNAME];
[newObj setACL:[PFACL ACLWithUser:some_pfUser]];
[newObj saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {//handle block execution.}]; 

However, I want something like:

[newObj addACLForUser:[PFACL ACLWithUser:second_pfUser]]; // Something like this.

[newObj saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {//handle block execution.}]; 

Can we do something like this? And if yes, how?

Thanks!


Solution

  • After talking to people at Parse, I got to know that the ACL should be set as a JSON list of all the users who want to access the content.