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 }
  • users Default implementation

    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.

    Default Implementation

    Declaration

    Swift

    var users: ParseRelation<Self>? { get }
  • roles Default implementation

    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.

    Default Implementation

    Declaration

    Swift

    var roles: ParseRelation<Self>? { get }
  • Create a an empty ParseRole.

    Warning

    It’s best to use the provided initializers, init(name: String) or init(name: String, acl: ParseACL) instead of init() as they ensure the ParseRole is setup properly.

    Declaration

    Swift

    init()
  • init(name:) Default implementation

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

    Throws

    An error of type ParseError if the name has invalid characters.

    Default Implementation

    Declaration

    Swift

    init(name: String) throws

    Parameters

    name

    The name of the Role to create.

  • init(name:acl:) Default implementation

    Create a ParseRole with a name.

    Throws

    An error of type ParseError if the name has invalid characters.

    Default Implementation

    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.

Default Implementations

  • className Extension method

    Declaration

    Swift

    static var className: String { get }
  • ==(_:_:) Extension method

    Declaration

    Swift

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

    Declaration

    Swift

    func hash(into hasher: inout Hasher)

ParseRelation

  • 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).

    Throws

    An error of type ParseError.

    Declaration

    Swift

    func queryRoles() throws -> Query<Self>

    Return Value

    An instance of query for easy chaining.

  • 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).

    Throws

    An error of type ParseError.

    Declaration

    Swift

    func queryUsers() throws -> Query<RoleUser>

    Return Value

    An instance of query for easy chaining.