corporateacademy-anag

Methods

(static) addUsersToGroup(userIds, cidOrEmailList, simulate, token) → {AddUsersToGroupResponse}

Adds the specified users to a group. They can be found by userId, email or cid.

Parameters:
Name Type Description
userIds string | Array.<string>

Required (if cidOrEmailList isn't defined): Id(s) of the users to add to the group

cidOrEmailList string | Array.<string>

Required (if userIds isn't defined): List of cids or emails of the users to add to the group

simulate boolean

Optional: If true, the users won't be added to the group but the analyzed list of users will be returned to the client

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP POST /rest-api/corporateacademy-mediator/add-users-to-group
Returns:

Counters of the matching users, the unmatched users and the added users

Type
AddUsersToGroupResponse

(static) countGroupsByTenant(searchedText, token) → {number}

Counts the groups from the graph db using filtering by the available tenants of the logged user

Parameters:
Name Type Description
searchedText string

Optional: Text used to filter on the groups titles in "like" mode

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/count-groups-by-tenant
Returns:

Counter of the matching groups

Type
number

(static) countManagers(editionItemId, managerType, token) → {number}

Counts the managers of the users that are assigned to the specified edition.

Parameters:
Name Type Description
editionItemId string

Required: Id of the item of the edition

managerType string

Required: Type of the managers to retrieve. The available types are defined in the ManagerTypes enum in the atfcore-commonclasses project

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/count-managers
Returns:

Counter of the managers of the matching users

Type
number

(static) countPersonsInTenant(searchedText, includeMe, token) → {number}

Retrieve persons' count of users in the same company's network group even without application access, filtered by a non-empty provided text. The persons returned are all the ones that match the criteria exluding the user itself.

Parameters:
Name Type Description
searchedText string

Required by the action: The searched text that will be matched in cid, forename and surname fields

includeMe boolean

Optional for the action: If true the result will include the user that made the search (default false)

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/count-persons-in-tenant
Returns:

Retrieved users count

Type
number

(static) countUsersByAnyField(userFilters, searchedText, useOptimizedSearchField, propertiesFilters, token) → {number}

Counts the users that match the specified parameters

Parameters:
Name Type Description
userFilters any

Required (if searchedText is null): A map which keys are fields to filter and values are the values (single value or array to "or") to search

searchedText string

Optional (if userFilters is defined): Text used to filter on the name/cid/email (or optimizedSearchField) of the persons

useOptimizedSearchField boolean

Optional: If true, the searchedText filter will be applied on the optimizedSearchField of the users

propertiesFilters ComparisonCondition | Array.<ComparisonCondition> | Array.<Array.<ComparisonCondition>>

Optional: Custom filters that will be applied to the Person node

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP POST /rest-api/corporateacademy-mediator/count-users-by-any-field
Returns:

Counter of the matching users

Type
number

(static) countUsersWhichCanSuggestItem(itemId, textFilter, token) → {Array.<User>}

Retrieves all users of a specific filter

Parameters:
Name Type Description
itemId string

Required: The itemId i want to suggest to someone

textFilter string

Optional: some text to filter in like mode and ignore case (check forename, surname, email, cid and nickname)

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/count-users-which-can-suggest-item
Returns:

Retrieved user data or null

Type
Array.<User>

(static) createGroup(title, referenceApplicationName, referenceType, referenceId, fromKey, token) → {UserGroup}

Creates a group of users

Parameters:
Name Type Description
title string

Required: The group name

referenceApplicationName string

Optional: The application name of the referenced object

referenceType string

Optional: The type of the referenced object

referenceId string

Optional: The id of the referenced object

fromKey string

Optional: The key that triggered the group creation

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP POST /rest-api/corporateacademy-mediator/create-group
Returns:

The new created group

Type
UserGroup

(static) createOrUpdateUser(cid, forename, surname, email, ruolo, socDistacco, chief, unit, department, token) → {UserGroup}

Add a new User to CorporateAcademy's users graph

Parameters:
Name Type Description
cid string

Required by the action: The user name

forename string

Required by the forename: The user name

surname string

Required by the surname: The user surname

email string

Required by the action: The user email

ruolo string

Optional by the action: The user role

socDistacco string

Optional by the action: The user company

chief string

Optional by the action: The user chief

unit string

Optional by the action: The user unit

department string

Optional by the action: The user department

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP POST /rest-api/corporateacademy-mediator/create-or-update-user
Returns:

The new created group

Type
UserGroup

(static) deleteGroup(groupId, token) → {UserGroup}

Deletes a group of users

Parameters:
Name Type Description
groupId string

Required: Id of the group to update

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP POST /rest-api/corporateacademy-mediator/delete-group
Returns:

The deleted group

Type
UserGroup

(static) deleteUser(userId, token) → {User}

Delete (logically) the users by the provided userId-s

Parameters:
Name Type Description
userId string | Array.<string>

Required by the action: The id or ids of the user to delete

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/delete-user
Returns:

Deleted user

Type
User

(static) exportConsumedCoursesToFileForTenantByCron(tenant, csvFile, fields, separator, quote, minDate, maxDate) → {null}

Export users' consumed items in a file from a cron timer

Parameters:
Name Type Description
tenant string

Required: the customer tenant

csvFile string

Required: the full path of csv file

fields Array.<string>

Required: the list of fields to export (see builders below to identify supported fields)

separator string

Optional: the csv file separator character

quote string

Optional: the csv file quotes character

minDate string

Optional: the minimum operation date to retrieve (YYYY-MM-DD)

maxDate string

Optional: the maximum operation date to retrieve (YYYY-MM-DD)

Returns:
Type
null

(static) exportUsers(withAllStatusLoaded, exportName, token) → {string}

Exports the course participant excel for the provided edition

Parameters:
Name Type Description
withAllStatusLoaded boolean

Optional: If true, all the faculty rent statuses will be retrieved (and not only the active ones)

exportName string

Optional: The export's filename, by default its "faculty_members.xlsx". An UUID will be appended to the filename.

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/export-users
Returns:

Export's filename

Type
string

(static) findUsersByAnyField(textFilter, fromRecord, numRecords, userFilters, orderBy, propertiesFilters, schema, token) → {Array.<User>}

Retrieves all users of a specific filter

Parameters:
Name Type Description
textFilter string

Optional: some text to filter in like mode and ignore case (check forename, surname, email, cid and nickname)

fromRecord number

Optional: Pagination start offset

numRecords number

Optional: Number of records to retrieve

userFilters string

Optional - other filters to filter users by

orderBy string

Optional - Order in which the users will be returned

propertiesFilters ComparisonCondition | Array.<ComparisonCondition> | Array.<Array.<ComparisonCondition>>

Optional: Custom filters that will be applied to the Person node

schema User

Optional: JSON object that contains the fields that needs to be retrieved (in a GraphQL-like style). The JSON property names must match the names of the fields of the Person nodes (that can be different from the ones defined into the @see {User} class). The schema can define the fields to retrieve for the userOptions/userTenant too.

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP POST /rest-api/corporateacademy-mediator/find-users-by-any-field
Returns:

Retrieved user data or null

Type
Array.<User>

(static) getAllUseracknowledges(token) → {UserAcknowledges}

Retrieve all userAcknowledges information (privacy acceptance, application tour completed, etc) accessing data by userId field

Parameters:
Name Type Description
token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/get-all-userAcknowledges
Returns:

Retrieved data

Type
UserAcknowledges

(static) getApplicationsEnabled(userId) → {User}

Retrieve all applications that user can access

Parameters:
Name Type Description
userId string

Required by the action: The UserId of the User to get

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/get-applications-enabled/:userId
Returns:

Retrieved user data or null

Type
User

(static) getCertificatesByTenant(token) → {Array.<CertificateList>}

List of all certificates by a tenant

Parameters:
Name Type Description
token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/get-certificates-by-tenant
Returns:

The certificate list by the logged user tenant

Type
Array.<CertificateList>

(static) getGroup(groupId, token) → {UserGroup}

Retrieves the specified group. The users count is always included.

Parameters:
Name Type Description
groupId string

Required: Id of the group from where the userIds will be retrieved

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/get-group
Returns:

The group object

Type
UserGroup

(static) getGroupUsers(groupId, searchedText, fromRecord, numRecords, allData, token) → {PaginationWrapper.<User>}

Retrieves the users of the specified group

Parameters:
Name Type Description
groupId string

Required: Id of the group from where the userIds will be retrieved

searchedText string

Optional: Text used to filter on the users forename/surname/email/cid

fromRecord number

Optional (if allData is true): Offset of the first record to retrieve

numRecords number

Optional (if allData is true): Number of records to retrieve

allData boolean

Optional (if fromRecord and numRecords are defined): All matching rows will be retrieved

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/get-group-users
Returns:

Array of users wrapped in another object for the pagination

Type
PaginationWrapper.<User>

(static) getLoggedUserType(token) → {Object}

Retrieve if the Network dashboard is visible

Parameters:
Name Type Description
token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/get-logged-user-type
Returns:

The data to display

Type
Object

(static) getPersonsInTenant(includeMe, searchedText, fromRecord, numRecords, token) → {Array.<User>}

Retrieve persons' data of users in the same company's network group even without application access, filtered by a non-empty provided text. The persons returned are all the ones that match the criteria exluding the user itself.

Parameters:
Name Type Description
includeMe boolean

Optional for the action: If true the result will include the user that made the search (default false)

searchedText string

Required by the action: The searched text that will be matched in cid, forename and surname fields

fromRecord number

Required by the action: The number of the first record to load (exclusive - 0 to start from the first)

numRecords number

Required by the action: The number of records to load

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/get-persons-in-tenant/:fromRecord/:numRecords
Returns:

Retrieved user data

Type
Array.<User>

(static) getTenantAnagConfig(token) → {Array.<String>}

Retrieves the specified group. The users count is always included.

Parameters:
Name Type Description
token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/get-tenant-anag-config
Returns:

The list of companies

Type
Array.<String>

(static) getTenantsByIds(tenantIds, token) → {Array.<Tenant>}

Load a list of Tenants from their id

Parameters:
Name Type Description
tenantIds Array.<string> | string

Required by the action: The tenant ids

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/get-tenants-by-ids
Returns:

The retrieved tenants

Type
Array.<Tenant>

(static) groupByGroupIds(groupIds, withUserIds, activeOnly, token) → {Array.<UserGroup>}

Retrieve all information about groups accessing data by groupId field

Parameters:
Name Type Description
groupIds Array.<string>

Required by the action: The list groupIds of the UserGroup to get

withUserIds boolean

Optional for the action: If true, return the list of userId in the group populating the users array with only their ids

activeOnly boolean

Optional for the action: If true the service search only active group (inactive group produce a OBJECT_NOT_FOUND error)

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/group-by-group-ids
Returns:

Retrieved group data or null

Type
Array.<UserGroup>

(static) importAnagFromFile(form, file, separator, quote, hasHeadersToSkip, isExternal, token) → {ImportTemp}

Import users visibilities file

Parameters:
Name Type Description
form Form

form data with sussequent parameters:

file File

Required: the csv file

separator string

Optional: the csv file separator character

quote string

Optional: the csv file quotes character

hasHeadersToSkip boolean

Optional: if true the first line of the file will be skipped

isExternal boolean

Optional: if true the person will be imported as external persons

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP POST /rest-api/corporateacademy-mediator/import-anag-from-file
Returns:

The object result of the import users into a temp table

Type
ImportTemp

(static) importAnagFromFileForTenantByCron(tenant, csvFile, separator, quote, hasHeadersToSkip, isExternal, companyFieldForcedValue) → {null}

Import users file from a cron timer

Parameters:
Name Type Description
tenant string

Required: the customer tenant

csvFile string

Required: the full path of csv file

separator string

Optional: the csv file separator character

quote string

Optional: the csv file quotes character

hasHeadersToSkip boolean

Optional: if true the first line of the file will be skipped

isExternal boolean

Optional: if true the person will be imported as external persons

companyFieldForcedValue string

Optional: the value to be forced in socDistacco field

Returns:
Type
null

(static) listCompanies(token) → {Array.<String>}

Retrieves list of society based on user tenant.

Parameters:
Name Type Description
token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/list-companies
Returns:

The list of companies

Type
Array.<String>

(static) listGroupsByTenant(searchedText, withUsersCount, fromRecord, numRecords, allData, token) → {Array.<UserGroup>}

Retrieves the groups from the graph db using filtering by the available tenants of the logged user

Parameters:
Name Type Description
searchedText string

Optional: Text used to filter on the groups titles in "like" mode

withUsersCount boolean

Optional: If true, the counter of the users in each group will be retrieved too

fromRecord number

Required (if allData is false): The number of the first record to load (exclusive - 0 to start from the first)

numRecords number

Required (if allData is false): The number of records to load

allData boolean

Optional (if fromRecord and numRecords are defined): If true, all the records will be retrieved

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/list-groups-by-tenant
Returns:

Array with the retrieved groups

Type
Array.<UserGroup>

(static) listManagers(editionItemId, managerType, mailType, fromRecord, numRecords, allData, token) → {Array.<ManagerData>}

Retrieves the managers of the users that are assigned to the specified edition.

Parameters:
Name Type Description
editionItemId string

Required: Id of the item of the edition

managerType string

Required: Type of the managers to retrieve. The available types are defined in the ManagerTypes enum in the atfcore-commonclasses project

mailType string

Required: Type of the emails to retrieve

fromRecord number

Optional: Offset of the first record to retrieve

numRecords number

Optional: Number of records to retrieve

allData boolean

Optional: All matching rows will be retrieved

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/list-managers/:fromRecord/:numRecords
Returns:

Array of managers data with manager's User object, the count of his subordinates and his last notify date

Type
Array.<ManagerData>

(static) listUsersWhichCanSuggestItem(itemId, textFilter, pageNum, numRecords, token) → {Array.<User>}

Retrieves all users of a specific filter

Parameters:
Name Type Description
itemId string

Required: The itemId i want to suggest to someone

textFilter string

Optional: some text to filter in like mode and ignore case (check forename, surname, email, cid and nickname)

pageNum number

Optional: number of the page (starts from 1)

numRecords number

Optional: The number of records to load

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/list-users-which-can-suggest-item
Returns:

Retrieved user data or null

Type
Array.<User>

(static) loginAcknowledgesCheck(token) → {LoginPreCheckAck}

Retrieve userAcknowledges information (privacy acceptance, application tour completed, personal data acceptance) for the specific application

Parameters:
Name Type Description
token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/login-acknowledges-check
Returns:

Retrieved data

Type
LoginPreCheckAck

(static) removeUsersFromGroup(userIds, cidOrEmailList, simulate, token) → {RemoveUsersFromGroupResponse}

Removes the specified users to a group. They can be found by userId, email or cid.

Parameters:
Name Type Description
userIds string | Array.<string>

Required (if cidOrEmailList isn't defined): Id(s) of the users to remove from the group

cidOrEmailList string | Array.<string>

Required (if userIds isn't defined): List of cids or emails of the users to remove from the group

simulate boolean

Optional: If true, the users won't be added to the group but the analyzed list of users will be returned to the client

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP POST /rest-api/corporateacademy-mediator/remove-users-from-group
Returns:

Counters of the matching users, the unmatched users and the removed users

Type
RemoveUsersFromGroupResponse

(static) removeUsersFromGroup(groupId, userIds, token)

Remove a list of users from a group, if present. User and Group must be in the same tenant

Parameters:
Name Type Description
groupId string

Required: The group to add the users

userIds Array.<string>

Required: The id of the users to add

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP POST /rest-api/corporateacademy-mediator/remove-users-from-group
Returns:

null

(static) searchUserForPublic(searchedText, tenant) → {User}

Searches for a user using the specified text, that will be used to filter on cid, email or userId NB: This is a public method, so anyone can use it

Parameters:
Name Type Description
searchedText string

Required: Text used to search the user

tenant string

Required: The tenant to filter

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/search-user-for-public
Returns:

User object of the first matching record

Type
User

(static) setAcknowledgesApplicationtour(token)

Set the personal data acceptance acknowledment for the user

Parameters:
Name Type Description
token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP POST /rest-api/corporateacademy-mediator/set-acknowledges-applicationTour
Returns:

null

(static) setAcknowledgesPersonaldata(token)

Set the personal data acceptance acknowledment for the user

Parameters:
Name Type Description
token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP POST /rest-api/corporateacademy-mediator/set-acknowledges-personalData
Returns:

null

(static) setAcknowledgesPrivacy(token)

Set the personal data acceptance acknowledment for the user

Parameters:
Name Type Description
token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP POST /rest-api/corporateacademy-mediator/set-acknowledges-privacy
Returns:

null

(static) updateGroup(groupId, title, referenceApplicationName, referenceType, referenceId, fromKey, token) → {UserGroup}

Updates a group of users

Parameters:
Name Type Description
groupId string

Required: Id of the group to update

title string

Required: The group name

referenceApplicationName string

Optional: The application name of the referenced object

referenceType string

Optional: The type of the referenced object

referenceId string

Optional: The id of the referenced object

fromKey string

Optional: The key that triggered the group creation

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP POST /rest-api/corporateacademy-mediator/update-group
Returns:

The updated group

Type
UserGroup

(static) updateUseracknowledges(null, token)

Update all userAcknowledges information (privacy acceptance, application tour completed, etc) accessing data by userId field. All fileds that are not specifically set to null are left unchanged: that is this method update the passed fields, append new fileds and left unchanged non passed fields.

Parameters:
Name Type Description
null
token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP POST /rest-api/corporateacademy-mediator/update-userAcknowledges

(static) updateUseroptions(userOptions, token) → {string}

Update all userOptions information (langCode, timezone, etc) accessing data by userId field. All fileds that are not specifically set to null are left unchanged: that is this method update the passed fields, append new fileds and left unchanged non passed fields.

Parameters:
Name Type Description
userOptions UserOptions

Required by the action: The UserOptions object to update

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP POST /rest-api/corporateacademy-mediator/update-userOptions
Returns:

The new token for the logged user

Type
string

(static) userByUserid(userId, withManagerData, token) → {User}

Retrieve all information about any user

Parameters:
Name Type Description
userId string

Required: The UserId of the User to get

withManagerData boolean

Optional: If true, the manager structure will be included in the resulting object

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/user-by-userId/:userId
Returns:

Retrieved user data or null

Type
User

(static) usersByUserids(userIds, token) → {Array.<User>}

Retrieves all users of a specific tenant

Parameters:
Name Type Description
userIds Array.<string>

Required by the action: list of users to retrive

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP POST /rest-api/corporateacademy-mediator/users-by-userIds
Returns:

Retrieved user data or null

Type
Array.<User>