com.parse

## Class ParseACL

- java.lang.Object
- - com.parse.ParseACL

    public class ParseACL
    extends Object

A `ParseACL` is used to control which users can access or modify a particular object. Each `ParseObject` can have its own `ParseACL`. You can grant read and write permissions separately to specific users, to groups of users that belong to roles, or you can grant permissions to "the public" so that, for example, any user could read a particular object but only a particular set of users could write to that object.

### Constructor Summary

Constructors
Constructor and Description
`ParseACL()` Creates an ACL with no permissions granted.
`ParseACL(ParseUser owner)` Creates an ACL where only the provided user has access.

### Method Summary

Methods
`boolean` `getPublicReadAccess()` Get whether the public is allowed to read this object.
`boolean` `getPublicWriteAccess()` Set whether the public is allowed to write this object.
`boolean` `getReadAccess(ParseUser user)` Get whether the given user id is *explicitly* allowed to read this object.
`boolean` `getReadAccess(String userId)` Get whether the given user id is *explicitly* allowed to read this object.
`boolean` `getRoleReadAccess(ParseRole role)` Get whether users belonging to the given role are allowed to read this object.
`boolean` `getRoleReadAccess(String roleName)` Get whether users belonging to the role with the given roleName are allowed to read this object.
`boolean` `getRoleWriteAccess(ParseRole role)` Get whether users belonging to the given role are allowed to write this object.
`boolean` `getRoleWriteAccess(String roleName)` Get whether users belonging to the role with the given roleName are allowed to write this object.
`boolean` `getWriteAccess(ParseUser user)` Get whether the given user id is *explicitly* allowed to write this object.
`boolean` `getWriteAccess(String userId)` Get whether the given user id is *explicitly* allowed to write this object.
`static void` `setDefaultACL(ParseACL acl, boolean withAccessForCurrentUser)` Sets a default ACL that will be applied to all `ParseObject`s when they are created.
`void` `setPublicReadAccess(boolean allowed)` Set whether the public is allowed to read this object.
`void` `setPublicWriteAccess(boolean allowed)` Set whether the public is allowed to write this object.
`void` `setReadAccess(ParseUser user, boolean allowed)` Set whether the given user is allowed to read this object.
`void` `setReadAccess(String userId, boolean allowed)` Set whether the given user id is allowed to read this object.
`void` `setRoleReadAccess(ParseRole role, boolean allowed)` Set whether users belonging to the given role are allowed to read this object.
`void` `setRoleReadAccess(String roleName, boolean allowed)` Set whether users belonging to the role with the given roleName are allowed to read this object.
`void` `setRoleWriteAccess(ParseRole role, boolean allowed)` Set whether users belonging to the given role are allowed to write this object.
`void` `setRoleWriteAccess(String roleName, boolean allowed)` Set whether users belonging to the role with the given roleName are allowed to write this object.
`void` `setWriteAccess(ParseUser user, boolean allowed)` Set whether the given user is allowed to write this object.
`void` `setWriteAccess(String userId, boolean allowed)` Set whether the given user id is allowed to write this object.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### ParseACL

    public ParseACL()

Creates an ACL with no permissions granted.

#### ParseACL

    public ParseACL(ParseUser owner)

Creates an ACL where only the provided user has access.

Parameters:
  `owner` - The only user that can read or write objects governed by this ACL.

### Method Detail

#### setDefaultACL

    public static void setDefaultACL(ParseACL acl,
                     boolean withAccessForCurrentUser)

Sets a default ACL that will be applied to all `ParseObject`s when they are created.

Parameters:
  `acl` - The ACL to use as a template for all `ParseObject`s created after setDefaultACL has been called. This value will be copied and used as a template for the creation of new ACLs, so changes to the instance after `setDefaultACL(ParseACL, boolean)` has been called will not be reflected in new `ParseObject`s.
  `withAccessForCurrentUser` - If `true`, the `ParseACL` that is applied to newly-created `ParseObject`s will provide read and write access to the `ParseUser.getCurrentUser()` at the time of creation. If `false`, the provided ACL will be used without modification. If acl is `null`, this value is ignored.

#### setPublicReadAccess

    public void setPublicReadAccess(boolean allowed)

Set whether the public is allowed to read this object.

#### getPublicReadAccess

    public boolean getPublicReadAccess()

Get whether the public is allowed to read this object.

#### setPublicWriteAccess

    public void setPublicWriteAccess(boolean allowed)

Set whether the public is allowed to write this object.

#### getPublicWriteAccess

    public boolean getPublicWriteAccess()

Set whether the public is allowed to write this object.

#### setReadAccess

    public void setReadAccess(String userId,
                     boolean allowed)

Set whether the given user id is allowed to read this object.

#### getReadAccess

    public boolean getReadAccess(String userId)

Get whether the given user id is *explicitly* allowed to read this object. Even if this returns `false`, the user may still be able to access it if getPublicReadAccess returns `true` or a role that the user belongs to has read access.

#### setWriteAccess

    public void setWriteAccess(String userId,
                      boolean allowed)

Set whether the given user id is allowed to write this object.

#### getWriteAccess

    public boolean getWriteAccess(String userId)

Get whether the given user id is *explicitly* allowed to write this object. Even if this returns `false`, the user may still be able to write it if getPublicWriteAccess returns `true` or a role that the user belongs to has write access.

#### setReadAccess

    public void setReadAccess(ParseUser user,
                     boolean allowed)

Set whether the given user is allowed to read this object.

#### getReadAccess

    public boolean getReadAccess(ParseUser user)

Get whether the given user id is *explicitly* allowed to read this object. Even if this returns `false`, the user may still be able to access it if getPublicReadAccess returns `true` or a role that the user belongs to has read access.

#### setWriteAccess

    public void setWriteAccess(ParseUser user,
                      boolean allowed)

Set whether the given user is allowed to write this object.

#### getWriteAccess

    public boolean getWriteAccess(ParseUser user)

Get whether the given user id is *explicitly* allowed to write this object. Even if this returns `false`, the user may still be able to write it if getPublicWriteAccess returns `true` or a role that the user belongs to has write access.

#### getRoleReadAccess

    public boolean getRoleReadAccess(String roleName)

Get whether users belonging to the role with the given roleName are allowed to read this object. Even if this returns `false`, the role may still be able to read it if a parent role has read access.

Parameters:
  `roleName` - The name of the role.
Returns:
  `true` if the role has read access. `false` otherwise.

#### setRoleReadAccess

    public void setRoleReadAccess(String roleName,
                         boolean allowed)

Set whether users belonging to the role with the given roleName are allowed to read this object.

Parameters:
  `roleName` - The name of the role.
  `allowed` - Whether the given role can read this object.

#### getRoleWriteAccess

    public boolean getRoleWriteAccess(String roleName)

Get whether users belonging to the role with the given roleName are allowed to write this object. Even if this returns `false`, the role may still be able to write it if a parent role has write access.

Parameters:
  `roleName` - The name of the role.
Returns:
  `true` if the role has write access. `false` otherwise.

#### setRoleWriteAccess

    public void setRoleWriteAccess(String roleName,
                          boolean allowed)

Set whether users belonging to the role with the given roleName are allowed to write this object.

Parameters:
  `roleName` - The name of the role.
  `allowed` - Whether the given role can write this object.

#### getRoleReadAccess

    public boolean getRoleReadAccess(ParseRole role)

Get whether users belonging to the given role are allowed to read this object. Even if this returns `false`, the role may still be able to read it if a parent role has read access. The role must already be saved on the server and its data must have been fetched in order to use this method.

Parameters:
  `role` - The role to check for access.
Returns:
  `true` if the role has read access. `false` otherwise.

#### setRoleReadAccess

    public void setRoleReadAccess(ParseRole role,
                         boolean allowed)

Set whether users belonging to the given role are allowed to read this object. The role must already be saved on the server and its data must have been fetched in order to use this method.

Parameters:
  `role` - The role to assign access.
  `allowed` - Whether the given role can read this object.

#### getRoleWriteAccess

    public boolean getRoleWriteAccess(ParseRole role)

Get whether users belonging to the given role are allowed to write this object. Even if this returns `false`, the role may still be able to write it if a parent role has write access. The role must already be saved on the server and its data must have been fetched in order to use this method.

Parameters:
  `role` - The role to check for access.
Returns:
  `true` if the role has write access. `false` otherwise.

#### setRoleWriteAccess

    public void setRoleWriteAccess(ParseRole role,
                          boolean allowed)

Set whether users belonging to the given role are allowed to write this object. The role must already be saved on the server and its data must have been fetched in order to use this method.

Parameters:
  `role` - The role to assign access.
  `allowed` - Whether the given role can write this object.