Reputation: 343
I need to set read and write access for two users on the same object. I could make a working solution, but I'm not sure that it's the nicest or correct way to do that. After I run the above lines, in the ACL column of the data browser I get two objectID what belongs to the two user that I want to be able to edit the object. So is it good? Or is there any room for improvement?
PFACL *objACL = [PFACL ACL];
[objACL setReadAccess:YES forUser:userB];
[objACL setWriteAccess:YES forUser:userB];
[objACL setReadAccess:YES forUser:[PFUser currentUser]];
[objACL setWriteAccess:YES forUser:[PFUser currentUser]];
PFObject *object = [PFObject objectWithClassName:@"ClassName"];
object.ACL = objACL
[object saveInBackground];
Upvotes: 2
Views: 56
Reputation: 189
If the users for each object are different then this is the appropriate way, otherwise you can assign a role to these two users and use setReadAccess:forRole
Upvotes: 1