AVRole Class Reference

Inherits from AVObject : NSObject
Declared in AVRole.h

Overview

Represents a Role on the LeanCloud server. AVRoles represent groupings of AVUsers for the purposes of granting permissions (e.g. specifying a AVACL for a AVObject). 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.

Creating a New Role

– initWithName:

Constructs a new AVRole with the given name. If no default ACL has been specified, you must provide an ACL for the role.

- (instancetype)initWithName:(NSString *)name

Parameters

name

The name of the Role to create.

Discussion

Constructs a new AVRole with the given name. If no default ACL has been specified, you must provide an ACL for the role.

Declared In

AVRole.h

– initWithName:acl:

Constructs a new AVRole with the given name.

- (instancetype)initWithName:(NSString *)name acl:(nullable AVACL *)acl

Parameters

name

The name of the Role to create.

acl

The ACL for this role. Roles must have an ACL.

Discussion

Constructs a new AVRole with the given name.

Declared In

AVRole.h

+ roleWithName:

Constructs a new AVRole with the given name. If no default ACL has been specified, you must provide an ACL for the role.

+ (instancetype)roleWithName:(NSString *)name

Parameters

name

The name of the Role to create.

Discussion

Constructs a new AVRole with the given name. If no default ACL has been specified, you must provide an ACL for the role.

Declared In

AVRole.h

+ roleWithName:acl:

Constructs a new AVRole with the given name.

+ (instancetype)roleWithName:(NSString *)name acl:(nullable AVACL *)acl

Parameters

name

The name of the Role to create.

acl

The ACL for this role. Roles must have an ACL.

Discussion

Constructs a new AVRole with the given name.

Declared In

AVRole.h

Role-specific Properties

  name

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.

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

@property (nonatomic, copy) NSString *name

Discussion

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.

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

Declared In

AVRole.h

– users

Gets the AVRelation for the AVUsers 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.

- (AVRelation *)users

Return Value

the relation for the users belonging to this role.

Discussion

Gets the AVRelation for the AVUsers 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.

Declared In

AVRole.h

– roles

Gets the AVRelation for the AVRoles 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.

- (AVRelation *)roles

Return Value

the relation for the roles belonging to this role.

Discussion

Gets the AVRelation for the AVRoles 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.

Declared In

AVRole.h

Querying for Roles

+ query

Returns a query for objects of type +parseClassName. This method can only be called on subclasses which conform to AVSubclassing. A default implementation is provided by AVObject which should always be sufficient.

+ (AVQuery *)query

Discussion

Returns a query for objects of type +parseClassName. This method can only be called on subclasses which conform to AVSubclassing. A default implementation is provided by AVObject which should always be sufficient.

Declared In

AVObject+Subclass.h