API Docs for:

Class Parse.ACL

Creates a new ACL. If no argument is given, the ACL has no permissions for anyone. If the argument is a Parse.User, the ACL will have read and write permission for only that user. If the argument is any other JSON object, that object will be interpretted as a serialized ACL created with toJSON().

Parse.ACL( )
Boolean equals( other )

Returns whether this ACL is equal to another object

Parameters:
  • other <Object>

    The other object to compare to


Returns: <Boolean>
Boolean getPublicReadAccess( )

Gets whether the public is allowed to read this object.


Returns: <Boolean>
Boolean getPublicWriteAccess( )

Gets whether the public is allowed to write this object.


Returns: <Boolean>
Boolean getReadAccess( 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 write access.

Parameters:
  • userId <Object>

    An instance of Parse.User or its objectId, or a Parse.Role.


Returns: <Boolean>
Boolean getRoleReadAccess( role )

Gets 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 write it if a parent role has read access.

Parameters:
  • role <Object>

    The name of the role, or a Parse.Role object.


Returns: <Boolean>

true if the role has read access. false otherwise.


Throws: <TypeError>

If role is neither a Parse.Role nor a String.

Boolean getRoleWriteAccess( role )

Gets 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.

Parameters:
  • role <Object>

    The name of the role, or a Parse.Role object.


Returns: <Boolean>

true if the role has write access. false otherwise.


Throws: <TypeError>

If role is neither a Parse.Role nor a String.

Boolean getWriteAccess( userId )

Gets 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.

Parameters:
  • userId <Object>

    An instance of Parse.User or its objectId, or a Parse.Role.


Returns: <Boolean>
setPublicReadAccess( allowed )

Sets whether the public is allowed to read this object.

Parameters:
  • allowed <Boolean>
setPublicWriteAccess( allowed )

Sets whether the public is allowed to write this object.

Parameters:
  • allowed <Boolean>
setReadAccess( userId, allowed )

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

Parameters:
  • userId <Object>

    An instance of Parse.User or its objectId.

  • allowed <Boolean>

    Whether that user should have read access.

setRoleReadAccess( role, allowed )

Sets whether users belonging to the given role are allowed to read this object.

Parameters:
  • role <Object>

    The name of the role, or a Parse.Role object.

  • allowed <Boolean>

    Whether the given role can read this object.


Throws: <TypeError>

If role is neither a Parse.Role nor a String.

setRoleWriteAccess( role, allowed )

Sets whether users belonging to the given role are allowed to write this object.

Parameters:
  • role <Object>

    The name of the role, or a Parse.Role object.

  • allowed <Boolean>

    Whether the given role can write this object.


Throws: <TypeError>

If role is neither a Parse.Role nor a String.

setWriteAccess( userId, allowed )

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

Parameters:
  • userId <Object>

    An instance of Parse.User or its objectId, or a Parse.Role..

  • allowed <Boolean>

    Whether that user should have write access.

Object toJSON( )

Returns a JSON-encoded version of the ACL.


Returns: <Object>