Manual Reference Source Test
public class | source

Role

Mixin Extends:

RoleModel, Helper

Helper class representing a user role.

Test:

Static Member Summary

Static Public Members
public static get

Method Summary

Public Methods
public

Gets the invitable user roles of the user role.

public

Gets the role permissions.

public

Saves a role (insert if id doesn't exist, update if it does)

Inherited Summary

From class RoleModel
public
public
public
public
public
public
public
public
public

Static Public Members

public static get type: String source

Public Methods

public getInvitableRoles(): Promise<Role> source

Gets the invitable user roles of the user role.

Return:

Promise<Role>

Returns a promise via ajax call.

Example:

import { Role, roleService } from 'clinical6';

const role = new Role({...});

// Grab the invitable roles
role.getInvitableRoles();

Test:

public getPermissions(): Promise<Permission> source

Gets the role permissions.

Return:

Promise<Permission>

Returns a promise via ajax call.

Example:

import { Role, roleService } from 'clinical6';

const role = new Role({...});

// Grab the role permissions
role.getPermissions();

Test:

public save(): Promise<Role> source

Saves a role (insert if id doesn't exist, update if it does)

Return:

Promise<Role>

Returns a promise via ajax call.

Example:

import { Role, roleService } from 'clinical6';

// Inserts new role (no existing id)
const role = new Role({
  "type": "user_roles",
  "attributes": {
      "permanent_link": "dummy_3669",
      "name": "et"
  }
});
role.save();

// Updates existing role(has existing id)
roleService.get().then(roles => roles[0].save());

Test: