Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Object Security parse.com android

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 346
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: