For an object, we can specify the access control of the object means which users are allowed to read the object and which users are allowed to write.
To do this, each object has an access control list. Parse provide ParseACL class to handle all this.
To create an object that only accessed by the current user, we specify it on setACL() method.
Below is the example:
ParseObject exampleObject = new ParseObject("Example");
exampleObject.put("content", "This is an example!");
exampleObject.setACL(new ParseACL(ParseUser.getCurrentUser()));
exampleObject.saveInBackground();
If we need to create object that access by publicly, we create an object of ParseACL.
Then pass the ParseACL object to setACL() method.
ParseACL parseACL = new ParseACL();
parseACL.setPublicReadAccess(true);
parseACL.setPublicWriteAccess(true);
ParseObject uploadVideo = new ParseObject("Example");
uploadVideo.put("user_id", ParseUser.getCurrentUser());
uploadVideo.put("thumbnail", parseThumb);
uploadVideo.setACL(parseACL);
uploadVideo.saveInBackground();
0 Comment(s)