Package com.parse

Class ParseRole


  • @ParseClassName("_Role")
    public class ParseRole
    extends ParseObject
    Represents a Role on the Parse server. ParseRoles 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.
    • 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 a ParseQuery 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 the ParseRelation for the ParseUsers 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 ParseRoles 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 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 ParseObjects. value may not be null.