Role

AV. Role

new Role(name, acl)

Source:
Represents a Role on the AV server. Roles represent groupings of Users for the purposes of granting permissions (e.g. specifying an ACL for an Object). 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.

An AV.Role is a local representation of a role persisted to the AV cloud.
Parameters:
Name Type Description
name String The name of the Role to create.
acl AV.ACL The ACL for this role.

Methods

getName() → {String}

Source:
Gets the name of the role. You can alternatively call role.get("name")
Returns:
the name of the role.
Type
String

getRoles() → {AV.Relation}

Source:
Gets the AV.Relation for the AV.Roles 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.

This is equivalent to calling role.relation("roles")

Returns:
the relation for the roles belonging to this role.
Type
AV.Relation

getUsers() → {AV.Relation}

Source:
Gets the AV.Relation for the AV.Users 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.

This is equivalent to calling role.relation("users")

Returns:
the relation for the users belonging to this role.
Type
AV.Relation

setName(name)

Source:
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.

This is equivalent to calling role.set("name", name)

Parameters:
Name Type Description
name String The name of the role.