com.parse

## Class ParseRole

- java.lang.Object
- - com.parse.ParseObject
  - - com.parse.ParseRole

    public class ParseRole
    extends ParseObject

Represents a Role on the Parse server. `ParseRole`s represent groupings of `ParseUsers` for the purposes of granting permissions (e.g. specifying a `ParseACL` for a `ParseObject`). 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

`DEFAULT_PIN`

### Constructor Summary

Constructors
Constructor and Description
`ParseRole(String name)` Constructs a new ParseRole with the given name.
`ParseRole(String name, ParseACL acl)` Constructs a new ParseRole with the given name.

### Method Summary

Methods
`String` `getName()` Gets the name of the role.
`static ParseQuery<ParseRole>` `getQuery()` Gets a `ParseQuery` over the Role collection.
`ParseRelation<ParseRole>` `getRoles()` Gets the `ParseRelation` for the `ParseRole`s that are direct children of this role.
`ParseRelation<ParseUser>` `getUsers()` Gets the `ParseRelation` for the `ParseUser`s that are direct children of this role.
`void` `put(String key, Object value)` Add a key-value pair to this object.
`void` `setName(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, fetch, fetchAll, fetchAllIfNeeded, fetchAllIfNeededInBackground, fetchAllIfNeededInBackground, fetchAllInBackground, fetchAllInBackground, fetchFromLocalDatastore, fetchFromLocalDatastoreInBackground, fetchIfNeeded, fetchIfNeededInBackground, fetchIfNeededInBackground, fetchInBackground, fetchInBackground, get, getACL, getBoolean, getBytes, getClassName, getCreatedAt, getDate, getDouble, getInt, getJSONArray, getJSONObject, getList, getLong, getMap, getNumber, getObjectId, getParseFile, getParseGeoPoint, getParseObject, getParseUser, getRelation, getString, getUpdatedAt, has, hasSameId, increment, increment, isDataAvailable, isDirty, isDirty, keySet, pin, pin, pinAll, pinAll, pinAllInBackground, pinAllInBackground, pinAllInBackground, pinAllInBackground, pinInBackground, pinInBackground, pinInBackground, pinInBackground, refresh, refreshInBackground, 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`

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

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

### Constructor Detail

#### ParseRole

    public ParseRole(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(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

#### setName

    public void setName(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:
  `IllegalStateException` - if the object has already been saved to the server.

#### getName

    public String getName()

Gets the name of the role.

Returns:
  the name of the role.

#### getUsers

    public ParseRelation<ParseUser> getUsers()

Gets the `ParseRelation` for the `ParseUser`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 the `ParseRelation` for the `ParseRole`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(String key,
           Object value)

Description copied from class: `ParseObject`
Add a key-value pair to this object. It is recommended to name keys in `camelCaseLikeThis`.

Overrides:
  `put` in class `ParseObject`
Parameters:
  `key` - Keys must be alphanumerical plus underscore, and start with a letter.
  `value` - Values may be numerical, `String`, `JSONObject`, `JSONArray`, `JSONObject.NULL`, or other `ParseObject`s. value may not be `null`.

#### getQuery

    public static ParseQuery<ParseRole> getQuery()

Gets a `ParseQuery` over the Role collection.

Returns:
  A new query over the Role collection.