Classes
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 |
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 |
Promise.<ApiResponse>
# async deleteRole(roleid) → {Promise.<ApiResponse>}
Delete a role.
Parameters:
Name | Type | Description |
---|---|---|
roleid |
string
|
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 |
- 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 |
- The response object
Promise.<ApiResponse>
# async getRoleAvatar(roleid) → {Promise.<ApiResponse>}
Fetch a role avatar (base64 string).
Parameters:
Name | Type | Description |
---|---|---|
roleid |
string
|
- 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 |
- 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>
|
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 |
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 |
Promise.<ApiResponse>