Class

UserRoleServices

UserRoleServices()

Service layer for CRUD operations on roles.

Constructor

# new UserRoleServices()

View Source infohub/UserRole.js, line 83

Classes

UserRoleServices

Methods

# async addUsersToRole(roleid, dataopt) → {Promise.<ApiResponse>}

Add users to a role.

Parameters:
Name Type Attributes Description
roleid string
data object <optional>

Payload

parentid string <optional>

The parent ID

userids Array.<string> <optional>

The user IDs

View Source infohub/UserRole.js, line 218

Promise.<ApiResponse>

# async createRole(dataopt) → {Promise.<ApiResponse>}

Create a new role.

Parameters:
Name Type Attributes Description
data object <optional>

Role payload

name string <optional>

The name

description string <optional>

The description

permissions object <optional>

The permissions

View Source infohub/UserRole.js, line 101

Promise.<ApiResponse>

# async deleteRole(roleid) → {Promise.<ApiResponse>}

Delete a role.

Parameters:
Name Type Description
roleid string

View Source infohub/UserRole.js, line 180

Promise.<ApiResponse>

# async getAllRoles(queryopt) → {Promise.<ApiResponse>}

List all roles (optionally filtered).

Parameters:
Name Type Attributes Description
query object <optional>

The query parameters

filter string <optional>

The filter

members string <optional>

The members

View Source infohub/UserRole.js, line 433

  • The response object
Promise.<ApiResponse>

# async getRole(roleid, queryopt) → {Promise.<ApiResponse>}

Fetch a single role by ID.

Parameters:
Name Type Attributes Description
roleid string
query object <optional>

The query parameters

filter string <optional>

The filter

members string <optional>

The members

View Source infohub/UserRole.js, line 380

  • The response object
Promise.<ApiResponse>

# async getRoleAvatar(roleid) → {Promise.<ApiResponse>}

Fetch a role avatar (base64 string).

Parameters:
Name Type Description
roleid string

View Source infohub/UserRole.js, line 335

  • The response object
Promise.<ApiResponse>

# async getRoles(roleList, queryopt, withAvatar) → {Promise.<ApiResponse>}

List roles by IDs (or all), optionally attaching avatars.

Parameters:
Name Type Attributes Description
roleList Array.<string>

List of role IDs

query object <optional>

The query parameters

filter string <optional>

The filter

members string <optional>

The members

withAvatar boolean

Whether to include the avatar of the roles

View Source infohub/UserRole.js, line 486

  • The response object
Promise.<ApiResponse>

# async removeUsersFromRole(roleid, userids) → {Promise.<ApiResponse>}

Remove users from a role.

Parameters:
Name Type Description
roleid string
userids Array.<string>

View Source infohub/UserRole.js, line 259

Promise.<ApiResponse>

# async updateRole(roleid, dataopt) → {Promise.<ApiResponse>}

Update an existing role.

Parameters:
Name Type Attributes Description
roleid string
data object <optional>

Role payload

name string <optional>

The name

description string <optional>

The description

permissions object <optional>

The permissions

View Source infohub/UserRole.js, line 145

Promise.<ApiResponse>

# async updateRoleAvatar(roleid, avatar) → {Promise.<ApiResponse>}

Update a role avatar (base64 string).

Parameters:
Name Type Description
roleid string
avatar string

Base64 encoded image

View Source infohub/UserRole.js, line 300

Promise.<ApiResponse>