Infohub JS API
Loading...
Searching...
No Matches
UserGroupServices Class Reference

Description

Service layer for CRUD operations on user groups.

Public Member Functions

async addUserToGroup (groupid, data)
 constructor (ctx=({}))
async createGroup (projCatId, type, data)
async deleteGroup (groupid)
async getGlobalGroups (query)
async getGroupAvatar (groupid)
async getGroupById (groupid, query)
async getGroups (projectList=[], catalogueList=[], globalGroups=false, query, withAvatar=false)
async getGroupsInCatalogue (catalogueid, query)
async getGroupsInProject (projectid, query)
async inviteUserToGroup (groupid, data)
async removeUserFromGroup (groupid, data)
async updateGroup (groupid, data)
async updateGroupAvatar (groupid, avatar)
async updateUserInGroup (userrelationId, data)

Function Documentation

◆ addUserToGroup()

async addUserToGroup ( groupid,
data )

Add a user to a group.

Parameters
{string}groupid - The group ID
{object}[data] - Payload
{string}[data.parentid] - The parent ID
{object[]}[data.userrelations] - The user relations of the group
{string}[data.userrelations[].userid] - The user ID
{string[]}[data.userrelations[].roles] - The roles of the user
{string}[data.userrelations[].companyid] - The company ID
{object}[data.userrelations[].userconfig] - The user config
Returns
{Promise<ApiResponse>}

◆ constructor()

constructor ( ctx = ({}))
Since
09.2025, aab
Parameters
{Context}ctx - Context instance

◆ createGroup()

async createGroup ( projCatId,
type,
data )

Create a new user group.

Parameters
{string}projCatId - The project or catalogue ID
{string}type - The type of group (project or catalogue)
{object}[data] - Group payload
{string}[data.name] - The name of the group
{string}[data.description] - The description of the group
{object}[data.permissions] - The permissions of the group
{string[]}[data.users] - The users of the group
{string[]}[data.roles] - The roles of the group
{string[]}[data.userrelations] - The user relations of the group
{string[]}[data.invitations] - The invitations of the group
Returns
{Promise<ApiResponse>}

◆ deleteGroup()

async deleteGroup ( groupid)

Delete a user group.

Parameters
{string}groupid - The group ID
Returns
{Promise<ApiResponse>}

◆ getGlobalGroups()

async getGlobalGroups ( query)

List global (scope‑wide) groups.

Parameters
{object}[query] - The query parameters
{string}[query.filter] - The filter
{string}[query.members] - The members
Returns
{Promise<ApiResponse>}

◆ getGroupAvatar()

async getGroupAvatar ( groupid)

Fetch a group's avatar (base64 string).

Parameters
{string}groupid - The group ID
Returns
{Promise<ApiResponse>} - The response object

◆ getGroupById()

async getGroupById ( groupid,
query )

Fetch a single group by ID.

Parameters
{string}groupid - The group ID
{object}[query] - The query parameters
{string}[query.filter] - The filter
{string}[query.members] - The members
Returns
{Promise<ApiResponse>} - The response object

◆ getGroups()

async getGroups ( projectList = [],
catalogueList = [],
globalGroups = false,
query,
withAvatar = false )

List groups across projects, catalogues, and/or global scope.

Parameters
{string[]}projectList - The project ids
{string[]}catalogueList - The catalogue ids
{boolean}globalGroups - Whether to include global user groups
{object}[query] - The query parameters
{string}[query.filter] - The filter
{string}[query.members] - The members
{boolean}withAvatar - Whether to include the avatar of the groups
Returns
{Promise<ApiResponse>} - The response object

◆ getGroupsInCatalogue()

async getGroupsInCatalogue ( catalogueid,
query )

List groups in a catalogue.

Parameters
{string}catalogueid - The catalogue ID
{object}[query] - The query parameters
{string}[query.filter] - The filter
{string}[query.members] - The members
Returns
{Promise<ApiResponse>}

◆ getGroupsInProject()

async getGroupsInProject ( projectid,
query )

List groups in a project.

Parameters
{string}projectid - The project ID
{object}[query] - The query parameters
{string}[query.filter] - The filter
{string}[query.members] - The members
Returns
{Promise<ApiResponse>}

◆ inviteUserToGroup()

async inviteUserToGroup ( groupid,
data )

Invite a user to a group (creates a pending invitation).

Parameters
{string}groupid - The group ID
{object}[data] - Payload
{string}[data.parentid] - The parent ID
{string}[data.message] - The message
{string}[data.subject] - The subject
{object[]}[data.userrelations] - The user relations of the group
{string}[data.userrelations[].userid] - The user ID
{string[]}[data.userrelations[].roles] - The roles of the user
{string}[data.userrelations[].companyid] - The company ID
{object}[data.userrelations[].userconfig] - The user config
Returns
{Promise<ApiResponse>} - The response object

◆ removeUserFromGroup()

async removeUserFromGroup ( groupid,
data )

Remove a user from a group.

Parameters
{string}groupid - The group ID
{object}[data] - Payload
{string}[data.userid] - The user ID
{string}[data.roleid] - The role ID
{string}[data.companyid] - The company ID
Returns
{Promise<ApiResponse>} - The response object

◆ updateGroup()

async updateGroup ( groupid,
data )

Update an existing user group.

Parameters
{string}groupid - The group ID
{object}[data] - Group payload
{string}[data.name] - The name of the group
{string}[data.description] - The description of the group
{object}[data.permissions] - The permissions of the group
{string[]}[data.users] - The users of the group
{string[]}[data.roles] - The roles of the group
{string[]}[data.userrelations] - The user relations of the group
{string[]}[data.invitations] - The invitations of the group
Returns
{Promise<ApiResponse>}

◆ updateGroupAvatar()

async updateGroupAvatar ( groupid,
avatar )

Update a group's avatar (base64 string).

Parameters
{string}groupid - The group ID
{string}avatar - The avatar base64 string
Returns
{Promise<ApiResponse>} - The response object

◆ updateUserInGroup()

async updateUserInGroup ( userrelationId,
data )

Update a user's membership in a group.

Parameters
{string}userrelationId - The user relation ID
{object}[data] - Payload
{string}[data.userid] - The user ID
{string[]}[data.roles] - The roles of the user
{string}[data.companyid] - The company ID
{object}[data.userconfig] - The user config
Returns
{Promise<ApiResponse>} - The response object