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)
orinit(name: String, acl: ParseACL)
. The provided initializers will overwrite whatever name is specified here, so you can useself.name = ""
Declaration
Swift
init()
-
className
Extension methodDeclaration
Swift
static var className: String { get }
-
init(name:
Extension method) Create a
ParseRole
with a name. TheParseACL
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:
Extension methodacl: ) 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. AParseRole
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)
-
users
Extension methodGets the
ParseRelation
for theParseUser
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 throughParseACL
s). You can add or remove users from the role through this relation.Declaration
Swift
var users: ParseRelation<Self> { get }
-
roles
Extension methodGets the
ParseRelation
for theParseRole
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 throughParseACL
s). 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 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 throughParseACL
s). -
queryRoles
Extension methodQuery the
ParseRelation
for theParseRole
‘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 throughParseACL
s).Declaration
Swift
var queryRoles: Query<Self>? { get }