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

Description

Data access/service layer for building user aggregates.

Public Member Functions

 constructor (ctx=({}))
async getCurrentUserData ()
async getCurrentUserLicences ()
async getCurrentUserScopes ()
async getGroupsOfUser (userid, projectList=[], catalogueList=[], globalGroups=false)
async getProjectsOfCurrentUser (query={})
async getUserAvatar (userid)
async getUsers (userids=[], projectid, catalogueid, globalGroups=false, userRoles=false, withInfo=false)
async updateCurrentUserData (data)

Function Documentation

◆ constructor()

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

◆ getCurrentUserData()

async getCurrentUserData ( )

Get current user's data from IDP# including last chosen role.

Returns
{Promise<ApiResponse>}

◆ getCurrentUserLicences()

async getCurrentUserLicences ( )

Get licences of current user current user will be determined by context.

Returns
{Promise<ApiResponse>} User

◆ getCurrentUserScopes()

async getCurrentUserScopes ( )

Internal: fetch role ids for a user.

Get scopes of current user will be determined by context

Returns
{Promise<{status: number, data: any}>}

◆ getGroupsOfUser()

async getGroupsOfUser ( userid,
projectList = [],
catalogueList = [],
globalGroups = false )

Get groups in which user 'userid' is contained.

Parameters
{string}userid
{*}projectList
{*}catalogueList
{*}globalGroups
Returns
{Promise<ApiResponse>} Example:
{
'status' : 200
'data' : {
'projectgroups' : [],
'cataloguegroups' : [],
'globalgroups' : []
}
}

◆ getProjectsOfCurrentUser()

async getProjectsOfCurrentUser ( query = {})

Get projects of the currently logged in user.


The function uses the token stored in the context object.

Since
10.2025, aab
Parameters
{object}[query] - Query object
{string[]}[query.members=['info']]
{string}[query.filter='']
Returns
{Promise<ApiResponse>} ApiResponse with list of json objects : Example:
[
{
"info": {
"created": "2025-09-30T08:41:06.953000",
"createdby": "alexander.rensch@colneo.email",
"depth": 0,
"name": "testProject AR",
"number": "test123",
"object_id": "test123",
"object_name": "testProject AR",
"object_type": "all_project",
"shortid": "1TYRUZ3Z_Ho=",
"type": "project",
"updated": "2025-09-30T08:41:06.969000",
"updatedby": "alexander.rensch@colneo.email"
}
}
}
]

◆ getUserAvatar()

async getUserAvatar ( userid)

Get avatar of a user.

Parameters
{string}userid - The user ID
Returns
{Promise<{status: number, data: any}>}

◆ getUsers()

async getUsers ( userids = [],
projectid,
catalogueid,
globalGroups = false,
userRoles = false,
withInfo = false )

Build user aggregates, optionally including groups, roles, and contact info.

Parameters
{string[]}userids - Array of user IDs
{string}[projectid] - Project ID
{string}[catalogueid] - Catalogue ID
{boolean}[globalGroups=false] - Include global groups
{boolean}[userRoles=false] - Include user roles
{boolean}[withInfo=false] - Include user contact info
Returns
{Promise<ApiResponse>} - The response object

◆ updateCurrentUserData()

async updateCurrentUserData ( data)

Update current user's data to IDP.

Parameters
{object}data - The user data
{string}[data.name] - The name
{object}[data.role] - The role object
{string}[data.role.roleid] - The role ID
{string}[data.role.scope] - The scope of the role
Returns
{Promise<ApiResponse>}