Constructor
new ParseCLP(userId)
Parameters:
Name | Type | Description |
---|---|---|
userId |
Parse.User
|
Parse.Role
|
object
|
The user to initialize the CLP for |
Methods
equals(other) → {boolean}
Returns whether this CLP is equal to another object
Parameters:
Name | Type | Description |
---|---|---|
other |
The other object to compare to |
Returns:
- Type:
-
boolean
getProtectedFields(userId) → {Array.<string>}
Returns array of fields are accessable to this user.
Parameters:
Name | Type | Description |
---|---|---|
userId |
An instance of Parse.User or its objectId, or a Parse.Role. |
Returns:
- Type:
-
Array.<string>
getPublicProtectedFields() → {Array.<string>}
Gets whether the public is allowed to read fields from this class.
Returns:
- Type:
-
Array.<string>
getPublicReadAccess() → {boolean}
Gets whether the public is allowed to read from this class.
Returns:
- Type:
-
boolean
getPublicWriteAccess() → {boolean}
Gets whether the public is allowed to write to this class.
Returns:
- Type:
-
boolean
getReadAccess(userId) → {boolean}
Get whether the given user id is explicitly allowed to read from this class. 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
getReadUserFields() → {Array.<string>}
Returns:
- Type:
-
Array.<string>
User pointer fields
getRoleProtectedFields(role) → {Array.<string>}
Gets whether users belonging to the given role are allowed to count to this user. Even if this returns false, the role may still be able to count it if a parent role has count 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:
-
Array.<string>
getRoleReadAccess(role) → {boolean}
Gets whether users belonging to the given role are allowed to read from this class. 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 to this user. 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 to this class. 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
getWriteUserFields() → {Array.<string>}
Returns:
- Type:
-
Array.<string>
User pointer fields
setProtectedFields(userId, fields)
Sets whether the given user is allowed to retrieve fields from this class.
Parameters:
Name | Type | Description |
---|---|---|
userId |
An instance of Parse.User or its objectId. |
|
fields |
Array.<string>
|
fields to be protected |
setPublicProtectedFields(fields)
Sets whether the public is allowed to protect fields in this class.
Parameters:
Name | Type | Description |
---|---|---|
fields |
Array.<string>
|
setPublicReadAccess(allowed)
Sets whether the public is allowed to read from this class.
Parameters:
Name | Type | Description |
---|---|---|
allowed |
boolean
|
setPublicWriteAccess(allowed)
Sets whether the public is allowed to write to this class.
Parameters:
Name | Type | Description |
---|---|---|
allowed |
boolean
|
setReadAccess(userId, allowed)
Sets whether the given user is allowed to read from this class.
Parameters:
Name | Type | Description |
---|---|---|
userId |
An instance of Parse.User or its objectId. |
|
allowed |
boolean
|
whether that user should have read access. |
setReadUserFields(pointerFields)
Sets user pointer fields to allow permission for get/count/find operations.
Parameters:
Name | Type | Description |
---|---|---|
pointerFields |
Array.<string>
|
User pointer fields |
setRoleProtectedFields(role, fields)
Sets whether users belonging to the given role are allowed to set access field in this class.
Parameters:
Name | Type | Description |
---|---|---|
role |
The name of the role, or a Parse.Role object. |
|
fields |
Array.<string>
|
Fields to be protected by Role. |
Throws:
-
If role is neither a Parse.Role nor a String.
- Type
-
TypeError
setRoleReadAccess(role, allowed)
Sets whether users belonging to the given role are allowed to read from this class.
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 to this class.
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 to this class.
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. |
setWriteUserFields(pointerFields)
Sets user pointer fields to allow permission for create/delete/update/addField operations
Parameters:
Name | Type | Description |
---|---|---|
pointerFields |
Array.<string>
|
User pointer fields |
toJSON() → {object}
Returns a JSON-encoded version of the CLP.
Returns:
- Type:
-
object