ParseRole

public protocol ParseRole : ParseObject

Objects that conform to the ParseRole protocol represent a Role on the Parse Server. ParseRole‘s represent groupings of ParseUser objects 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 a ParseACL.

  • Gets or 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.

    Warning

    A role’s name can only contain alphanumeric characters, _, -, and spaces.

    Declaration

    Swift

    var name: String { get set }
  • Create a ParseRole. It’s best to use the provided initializers, init(name: String) or init(name: String, acl: ParseACL). The provided initializers will overwrite whatever name is specified here, so you can use self.name = ""

    Declaration

    Swift

    init()

Default Implementations

  • className Extension method

    Declaration

    Swift

    static var className: String { get }
  • init(name:) Extension method

    Create a ParseRole with a name. The ParseACL will still need to be initialized before saving.

    Throws

    ParseError if the name has invalid characters.

    Declaration

    Swift

    init(name: String) throws

    Parameters

    name

    The name of the Role to create.

  • init(name:acl:) Extension method

    Create a ParseRole with a name.

    Throws

    ParseError if the name has invalid characters.

    Declaration

    Swift

    init(name: String, acl: ParseACL) throws

    Parameters

    name

    The name of the Role to create.

    acl

    The ParseACL for this role. Roles must have an ACL. A ParseRole is a local representation of a role persisted to the Parse Server.

  • ==(_:_:) Extension method

    Declaration

    Swift

    static func == (lhs: Self, rhs: Self) -> Bool
  • hash(into:) Extension method

    Declaration

    Swift

    func hash(into hasher: inout Hasher)

ParseRelation

  • users Extension method

    Gets the ParseRelation for the ParseUser objects 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 ParseACLs). You can add or remove users from the role through this relation.

    Declaration

    Swift

    var users: ParseRelation<Self> { get }
  • roles Extension method

    Gets the ParseRelation for the ParseRole objects 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 ParseACLs). You can add or remove child roles from this role through this relation.

    Declaration

    Swift

    var roles: ParseRelation<Self> { get }
  • queryUsers(_:) Extension method

    Query 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 ParseACLs).

    Declaration

    Swift

    func queryUsers<T>(_ user: T) throws -> Query<T> where T : ParseUser
  • queryRoles Extension method

    Query the ParseRelation for the ParseRole‘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 ParseACLs).

    Declaration

    Swift

    var queryRoles: Query<Self>? { get }