Package com.parse
Class ParseRole
- java.lang.Object
-
- com.parse.ParseObject
-
- com.parse.ParseRole
-
@ParseClassName("_Role") public class ParseRole extends ParseObject
Represents a Role on the Parse server.ParseRole
s represent groupings ofParseUsers
for the purposes of granting permissions (e.g. specifying aParseACL
for aParseObject
). Roles are specified by their sets of child users and child roles, all of which are granted any permissions that the parent role has.
Roles must have a name (which cannot be changed after creation of the role), and must specify an ACL.
-
-
Field Summary
-
Fields inherited from class com.parse.ParseObject
CREATOR, DEFAULT_PIN, KEY_CREATED_AT, KEY_OBJECT_ID, KEY_UPDATED_AT
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getName()
Gets the name of the role.static ParseQuery<ParseRole>
getQuery()
Gets aParseQuery
over the Role collection.ParseRelation<ParseRole>
getRoles()
Gets theParseRelation
for theParseRole
s that are direct children of this role.ParseRelation<ParseUser>
getUsers()
Gets theParseRelation
for theParseUser
s that are direct children of this role.void
put(java.lang.String key, java.lang.Object value)
Add a key-value pair to this object.void
setName(java.lang.String name)
Sets the name for a role.-
Methods inherited from class com.parse.ParseObject
add, addAll, addAllUnique, addUnique, containsKey, create, create, createWithoutData, createWithoutData, delete, deleteAll, deleteAllInBackground, deleteAllInBackground, deleteEventually, deleteEventually, deleteInBackground, deleteInBackground, describeContents, fetch, fetchAll, fetchAllIfNeeded, fetchAllIfNeededInBackground, fetchAllIfNeededInBackground, fetchAllInBackground, fetchAllInBackground, fetchFromLocalDatastore, fetchFromLocalDatastoreInBackground, fetchIfNeeded, fetchIfNeededInBackground, fetchIfNeededInBackground, fetchInBackground, fetchInBackground, fromJSON, fromJSON, get, getACL, getBoolean, getBytes, getClassName, getCreatedAt, getDate, getDouble, getInt, getJSONArray, getJSONObject, getList, getLong, getMap, getNumber, getObjectId, getParseFile, getParseGeoPoint, getParseObject, getParsePolygon, getParseUser, getRelation, getString, getUpdatedAt, has, hasSameId, increment, increment, isDataAvailable, isDataAvailable, isDirty, isDirty, keySet, pin, pin, pinAll, pinAll, pinAllInBackground, pinAllInBackground, pinAllInBackground, pinAllInBackground, pinInBackground, pinInBackground, pinInBackground, pinInBackground, registerSubclass, remove, removeAll, revert, revert, save, saveAll, saveAllInBackground, saveAllInBackground, saveEventually, saveEventually, saveInBackground, saveInBackground, setACL, setObjectId, unpin, unpin, unpinAll, unpinAll, unpinAll, unpinAll, unpinAllInBackground, unpinAllInBackground, unpinAllInBackground, unpinAllInBackground, unpinAllInBackground, unpinAllInBackground, unpinAllInBackground, unpinAllInBackground, unpinInBackground, unpinInBackground, unpinInBackground, unpinInBackground, writeToParcel
-
-
-
-
Constructor Detail
-
ParseRole
public ParseRole(java.lang.String name)
Constructs a new ParseRole with the given name. If no default ACL has been specified, you must provide an ACL for the role.- Parameters:
name
- The name of the Role to create.
-
ParseRole
public ParseRole(java.lang.String name, ParseACL acl)
Constructs a new ParseRole with the given name.- Parameters:
name
- The name of the Role to create.acl
- The ACL for this role. Roles must have an ACL.
-
-
Method Detail
-
getQuery
public static ParseQuery<ParseRole> getQuery()
Gets aParseQuery
over the Role collection.- Returns:
- A new query over the Role collection.
-
getName
public java.lang.String getName()
Gets the name of the role.- Returns:
- the name of the role.
-
setName
public void setName(java.lang.String name)
Sets the name for a role. This value must be set before the role has been saved to the server, and cannot be set once the role has been saved.
A role's name can only contain alphanumeric characters, _, -, and spaces.- Parameters:
name
- The name of the role.- Throws:
java.lang.IllegalStateException
- if the object has already been saved to the server.
-
getUsers
public ParseRelation<ParseUser> getUsers()
Gets theParseRelation
for theParseUser
s that are direct children of this role. These users are granted any privileges that this role has been granted (e.g. read or write access through ACLs). You can add or remove users from the role through this relation.- Returns:
- the relation for the users belonging to this role.
-
getRoles
public ParseRelation<ParseRole> getRoles()
Gets theParseRelation
for theParseRole
s that are direct children of this role. These roles' users are granted any privileges that this role has been granted (e.g. read or write access through ACLs). You can add or remove child roles from this role through this relation.- Returns:
- the relation for the roles belonging to this role.
-
put
public void put(java.lang.String key, java.lang.Object value)
Description copied from class:ParseObject
Add a key-value pair to this object. It is recommended to name keys incamelCaseLikeThis
.- Overrides:
put
in classParseObject
- Parameters:
key
- Keys must be alphanumerical plus underscore, and start with a letter.value
- Values may be numerical,String
,JSONObject
,JSONArray
,JSONObject#NULL
, or otherParseObject
s. value may not benull
.
-
-