PFRole
Objective-C
@interface PFRole : PFObject <PFSubclassing>
Swift
class PFRole : PFObject, PFSubclassing
The PFRole class represents a Role on the Parse server.
PFRoles represent groupings of PFUser objects for the purposes of granting permissions
(e.g. specifying a PFACL for a PFObject).
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.
-
Constructs a new
PFRolewith the given name. If no default ACL has been specified, you must provide an ACL for the role.Declaration
Objective-C
- (nonnull instancetype)initWithName:(nonnull NSString *)name;Swift
init(name: String)Parameters
nameThe name of the Role to create.
-
Constructs a new
PFRolewith the given name.If no default ACL has been specified, you must provide an ACL for the role.
Declaration
Objective-C
+ (nonnull instancetype)roleWithName:(nonnull NSString *)name;Parameters
nameThe name of the Role to create.
-
Constructs a new
PFRolewith the given name.Declaration
Objective-C
+ (nonnull instancetype)roleWithName:(nonnull NSString *)name acl:(nullable PFACL *)acl;Parameters
nameThe name of the Role to create.
aclThe ACL for this role. Roles must have an ACL.
-
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
Objective-C
@property (nonatomic, copy) NSString *_Nonnull name;Swift
var name: String { get set } -
Gets the
PFRelationfor thePFUserobjects 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.
Declaration
Objective-C
@property (nonatomic, strong, readonly) PFRelation<PFUser *> *_Nonnull users;Swift
var users: PFRelation { get } -
Gets the
PFRelationfor thePFRoleobjects 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.
Declaration
Objective-C
@property (nonatomic, strong, readonly) PFRelation<PFRole *> *_Nonnull roles;Swift
var roles: PFRelation { get }
View on GitHub
Install in Dash