Class

UserRoleServices

UserRoleServices(ctx)

Service layer for CRUD operations on roles.

Constructor

# new UserRoleServices(ctx)

Parameters:
Name Type Description
ctx Context

Context instance

Since:
  • 09.2025, aab

View Source infohub/UserRole.js, line 75

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 178

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 93

Promise.<ApiResponse>

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

Delete a role.

Parameters:
Name Type Description
roleid string

View Source infohub/UserRole.js, line 150

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 351

  • 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 304

  • 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 265

  • 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 398

  • 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 208

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 126

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 238

Promise.<ApiResponse>