Role
Helper class representing a user role.
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 |
|
Public Methods
public getInvitableRoles(): Promise<Role> source
Gets the invitable user roles of the user role.
Example:
import { Role, roleService } from 'clinical6';
const role = new Role({...});
// Grab the invitable roles
role.getInvitableRoles();
public getPermissions(): Promise<Permission> source
Gets the role permissions.
Example:
import { Role, roleService } from 'clinical6';
const role = new Role({...});
// Grab the role permissions
role.getPermissions();
public save(): Promise<Role> source
Saves a role (insert if id doesn't exist, update if it does)
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());