Constructor
new ACL(user)
Parameters:
Name | Type | Description |
---|---|---|
user |
Parse.User
|
Object
|
The user to initialize the ACL for |
Methods
equals(other) → {Boolean}
Returns whether this ACL is equal to another object
Parameters:
Name | Type | Description |
---|---|---|
other |
The other object to compare to |
Returns:
- Type:
-
Boolean
getPublicReadAccess() → {Boolean}
Gets whether the public is allowed to read this object.
Returns:
- Type:
-
Boolean
getPublicWriteAccess() → {Boolean}
Gets whether the public is allowed to write this object.
Returns:
- Type:
-
Boolean
getReadAccess(userId) → {Boolean}
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:
Name | Type | Description |
---|---|---|
userId |
An instance of Parse.User or its objectId, or a Parse.Role. |
Returns:
- Type:
-
Boolean
getRoleReadAccess(role) → {Boolean}
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:
Name | Type | Description |
---|---|---|
role |
The name of the role, or a Parse.Role object. |
Throws:
-
If role is neither a Parse.Role nor a String.
- Type
-
TypeError
Returns:
- Type:
-
Boolean
true if the role has read access. false otherwise.
getRoleWriteAccess(role) → {Boolean}
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:
Name | Type | Description |
---|---|---|
role |
The name of the role, or a Parse.Role object. |
Throws:
-
If role is neither a Parse.Role nor a String.
- Type
-
TypeError
Returns:
- Type:
-
Boolean
true if the role has write access. false otherwise.
getWriteAccess(userId) → {Boolean}
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:
Name | Type | Description |
---|---|---|
userId |
An instance of Parse.User or its objectId, or a Parse.Role. |
Returns:
- Type:
-
Boolean
setPublicReadAccess(allowed)
Sets whether the public is allowed to read this object.
Parameters:
Name | Type | Description |
---|---|---|
allowed |
Boolean
|
setPublicWriteAccess(allowed)
Sets whether the public is allowed to write this object.
Parameters:
Name | Type | Description |
---|---|---|
allowed |
Boolean
|
setReadAccess(userId, allowed)
Sets whether the given user is allowed to read this object.
Parameters:
Name | Type | Description |
---|---|---|
userId |
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:
Name | Type | Description |
---|---|---|
role |
The name of the role, or a Parse.Role object. |
|
allowed |
Boolean
|
Whether the given role can read this object. |
Throws:
-
If role is neither a Parse.Role nor a String.
- Type
-
TypeError
setRoleWriteAccess(role, allowed)
Sets whether users belonging to the given role are allowed to write this object.
Parameters:
Name | Type | Description |
---|---|---|
role |
The name of the role, or a Parse.Role object. |
|
allowed |
Boolean
|
Whether the given role can write this object. |
Throws:
-
If role is neither a Parse.Role nor a String.
- Type
-
TypeError
setWriteAccess(userId, allowed)
Sets whether the given user id is allowed to write this object.
Parameters:
Name | Type | Description |
---|---|---|
userId |
An instance of Parse.User or its objectId, or a Parse.Role.. |
|
allowed |
Boolean
|
Whether that user should have write access. |
toJSON() → {Object}
Returns a JSON-encoded version of the ACL.
Returns:
- Type:
-
Object