Skip to main content
Version: v5.2

IafPassSvc

Use the IafPassSvc API to create and manage the passport service resources, such as users, session users, user groups, user group invites, workspaces, applications, notification templates, and permissions.

addUsersToGroup

Adds users to a user group. To use this method, the current user nust have edit permission for the group.

ParameterRequiredTypeDescription
idYesStringThe user group's id
userIdsYesArray<String>The ids of the users you want to add to the user group
ctxNoCtxContext, such as namespaces and authentication token information.
Returns

Array<User> - The array of the User class objects you add

Examples
const newUsers = await IafPassSvc.addUsersToGroup(id, userIds, ctx);

addUserToGroupByInvite

Adds a user to a user group after they accept an invitation.

ParameterRequiredTypeDescription
groupIdYesStringPass the user group's UUID.
inviteIdYesStringPass the invite's UUID.
ctxNoCtxContext, such as namespaces and authentication token information.
Returns

Array<User> - The user details of the invitee

Examples
const users = await IafPassSvc.addUserToGroupByInvite(groupId, inviteId);

createApplication

Creates an application

ParameterRequiredTypeDescription
applicationYesApplicationApplication object with app owner user id and organization id
ctxNoCtxContext, contains authentication token information
optionsNoanyReserved for future use; the create-application endpoint does not read any query options, so this parameter currently has no effect.
Returns

Promise<Application> - The newly created Application object.

Examples
{
"_id":"94a1eb2b-06bd-426e-a3ce-e7ab609ea231",
"_name": "DigitalTwin",
"_appOwner": "dtowner@xxxxxx.com",
"_userType":"web_app",
"_redirectUris":"https://app.xxxxxx.com/dt/login",
"_home":"https://app.xxxxxx.com/dt",
"_orgId":"36a1eb2b-06bd-426e-a3ce-e7ab609ea825"
}

createNotificationTemplates

Creates multiple NotificationTemplate class objects.

ParameterRequiredTypeDescription
notificationTemplatesYesArray<NotificationTemplate>Pass an array of NotificationTemplate object.
ctxNoCtxContext, such as namespaces and authentication token information
optionsNoCreateNotificationTemplateOptionscontains optional params such as _appId
Returns

Promise<Page<NotificationTemplate>> - A promise with a page of the created NotificationTemplate objects

Examples
const notificationTemplates = [
{
_name: "app1_invite",
_title: "Invitaion to join Application 1",
_message: "Click the following link to join the application:",
_format: "text"
},
{
_name: "app2_invite",
_title: "Invitaion to join Application 2",
_message: "Click the following link to join the application:",
_format: "text"
}
];

const creatednotificationTemplates = await IafPassSvc.createNotificationTemplates(notificationTemplates);

createOrganization

Creates an Organization.

ParameterRequiredTypeDescription
organizationYesOrganizationPass a Organization object you define.
ctxNoCtxContext, authentication token information.
optionsNoOptionsPass a JSON object for optional query params
Returns

Promise<Organization> - A promise with a page that contains the created Organization object

Examples
let org = {
"_name": "ABC Organization",
"_orgOwner": "org_owner@xxxxorg.com",
"_shortName":"abc_org"
}


IafPassSvc.createOrganization(org);

createPermissionProfiles

Creates multiple PermissionProfile class objects

ParameterRequiredTypeDescription
permissionProfilesYesArray<PermissionProfile>Array of PermissionProfile objects totalling a maximum of 1MB of data
ctxNoCtxContext, such as namespaces and authentication token information
Returns

Promise<Page<PermissionProfile>> -

createPermissions

Creates Permission class objects for Passport Service resources such as Workspaces and UserGroups. You can create a maximum of 25 permissions at a time.

ParameterRequiredTypeDescription
permissionsYesArray<Permission>Pass an array of Permission objects you define.
ctxNoCtxContext, such as namespaces and authentication token information.
optionsNoPermissionOptionsPass a a JSON object with one or more Page object parameters, such as "_offset" or "_pageSize". The default value for offset is 0 and for page size is 10.
Returns

CreatePermissionsResponse - A CreatePermissionsResponse object with with separate arrays of the successful and failed permissions

Examples
// Permissions with mandatory fields
const permissions = [{
_actions: [ IafPermission.PermConst.Action.Read, IafPermission.PermConst.Action.Share, IafPermission.PermConst.Action.Delete ],
_namespace: "ProjA_HEpftR8X",
_resourceDesc:{
_irn: "passportsvc:workspace:*" // Refer {Permission} for more valid irns
},
_user: {
_id: "75b2a3d6-a3e8-498d-99dc-23538bc9a389", // Either user or usergroup, specify respective _type
_type: IafPermission.PermConst.UserType.User // Either user or usergroup, specify respective _id
}
}];

const result = await IafPassSvc.createPermissions(permissions, ctx);

// Permissions with criteria
const permissions = [{
_actions: [ IafPermission.PermConst.Action.Read, IafPermission.PermConst.Action.Share, IafPermission.PermConst.Action.Delete],
_namespace: "ProjA_HEpftR8X",
_resourceDesc: {
_irn: "passportsvc:workspace:*",
_criteria: {
usertype: "project"
}
},
_user: {
_id: "75b2a3d6-a3e8-498d-99dc-23538bc9a389", // Either user or usergroup, specify respective _type
_type: IafPermission.PermConst.UserType.User // Either user or usergroup, specify respective _id
}
}];

const result = await IafPassSvc.createPermissions(permissions, ctx);

createSecrets

Creates a Secret resources.

ParameterRequiredTypeDescription
secretsYesArray<Secret>Array of Secret objects that contains the Secret definition. The _name is unique
ctxNoCtxContext, such as namespaces and authentication token information.
optionsNoOptionsOptional query parameters.
Returns

Promise<Page<Secret>> - Returns a promise with a Page object that contains the created Secret objects.

Examples
const secrets = [{
_name: "OPENAI_API_KEY",
_value: "sk_qresecret124302",
_description: "Database password for reporting app",
_userType: "service",
_namespaces: ["air_rtwowe13s"]
}];
const createdSecrets = await IafPassSvc.createSecrets(secrets, ctx);

createUser

Creates a new User class object.

ParameterRequiredTypeDescription
bodyYesUserPass a User object that contains the User definition.
ctxNoCtxContext, such as namespaces and authentication token information
optionsNoOptionsPass an Options object with your offset and page size options. The default value for "_offset" is 0 and for "_pageSize" is 10.
Returns

Promise<User> - Returns a promise with the created User object.

Examples
// Create a new user, Please set the optional _tempPassword to true to consider _password as temporary and enforce the user to reset the password on their first login
const body = {
_firstname: "John",
_lastname: "Doe",
_email: "johndoe@mail.com",
_password: "Test@123",
_tempPassword: true
};

const user = await IafPassSvc.createUser(userData, ctx);

createUserGroup

Creates a UserGroup class object.

ParameterRequiredTypeDescription
userGroupYesUserGroupPass a UserGroup object with the properties and values you define.
ctxNoCtxContext, such as namespaces and authentication token information.
optionsNoOptionsPass a JSON object for optional query params such as {_appId:'edf36978-cf47-49ac-aa88-3183705b25e0'}
Returns

Promise<Page<UserGroup>> - A promise with a Page object that contains the created UserGroup object

Examples
let userGroup = {
_name: "user_group_for_testing_purposes",
_description: "User group for the purpose of this example"
_shortName: "test_user_group",
_namespaces: "ProjA_HEpftR8X",
_userType: "example_user_group"
};

const userGroup = await IafPassSvc.createUserGroup(userGroup);

createUserGroups

Create multiple UserGroup class objects. You can create a maximum of 25 user groups at a time.

ParameterRequiredTypeDescription
userGroupsYesArray<UserGroup>Pass an array of UserGroup JSON objects you want to create.
ctxYesCtxContext, such as namespaces and authentication token information
optionsNoOptionsPass a JSON object for optional query params such as {_appId:'edf36978-cf47-49ac-aa88-3183705b25e0'}
Returns

Promise<Page<UserGroup>> - A Page object with the UserGroup objects you create

Examples
let userGroups = [
{
_name: "user_group_for_testing_purposes",
_description:"User group for the purpose of this example"
_shortName: "test_user_group",
_namespaces: "ProjA_HEpftR8X",
_userType: "example_user_group"
},
{
_name: "second_user_group_for_testing_purposes",
_description:"Second user group for the purpose of this example"
_shortName: "test_user_group_2",
_namespaces: "ProjA_HEpftR8X",
_userType: "example_user_group"
}
];

const userGroups = await IafPassSvc.createUserGroups(userGroups);

createWorkspace

Creates a Workspace class object.

ParameterRequiredTypeDescription
workspaceYesWorkspacePass a Workspace object you define.
ctxNoCtxContext, such as namespaces and authentication token information.
optionsNoOptionsPass a JSON object for optional query params such as {_appId:'edf36978-cf47-49ac-aa88-3183705b25e0'}
Returns

Promise<Page<Workspace>> - A promise with a page that contains the created Workspace object

Examples
let workspace = {
_description: "Project A workspace",
_name: "Project A",
_shortName: "Proj_A",
_namespaces: "ProjA_HEpftR8X",
_userAttributes: {
createdDate: new Date().toISOString()
},
};

IafPassSvc.createWorkspace(workspace);

createWorkspaces

Creates multiple Workspace class objects. You can create a maximum of 25 workspaces at a time.

ParameterRequiredTypeDescription
workspacesYesArray<Workspace>Pass an array of Workspace objects you define.
ctxNoCtxContext, such as namespaces and authentication token information.
optionsNoOptionsPass a JSON object for optional query params such as {_appId:'edf36978-cf47-49ac-aa88-3183705b25e0'}
Returns

Promise<Page<Workspace>> - A promise with a page that contains the Workspace object you create

Examples
const workspaces = [
{
_description: "Project A workspace",
_name: "Project A",
_shortName: "Proj_A",
_namespaces: "ProjA_HEpftR8X",
_userAttributes: {
createdDate: new Date().toISOString()
},
},
{
_description: "Project B workspace",
_name: "Project B",
_shortName: "Proj_B",
_namespaces: "ProjB_TGpftY3H",
_userAttributes: {
createdDate: new Date().toISOString()
},
},
];

const createdworkpaces = await IafPassSvc.createWorkspaces(workspaces);

deleteApplication

Deletes an application

ParameterRequiredTypeDescription
idYesStringThe Application's UUID.
ctxYesCtxContext, such as namespaces and authentication token information.
Returns

Promise<String> - {ok:204} response

Examples
const applicationConfigs = await deleteApplication(id, ctx);

deleteApplicationConfigs

Deletes the applicationConfigs by applicationId (appId)

ParameterRequiredTypeDescription
idYesStringThe Application's UUID.
ctxYesCtxContext, such as namespaces and authentication token information.
Returns

Promise<String> - {ok:204} response

Examples
const applicationConfigs = await deleteApplicationConfigs(id, ctx);

deleteNotificationTemplate

Deletes a NotificationTemplate class object.

ParameterRequiredTypeDescription
idYesStringThe NotificationTemplate's id
ctxNoCtxContext, such as namespaces and authentication token information
Returns

Promise<String> - {ok:204} response

Examples
const response = await IafPassSvc.deleteNotificationTemplate(id);

deleteOrganization

Soft deletes a organization.

ParameterRequiredTypeDescription
idYesStringPass the organization's id.
ctxNoCtxContext, such as namespaces and authentication token information.
Returns

Promise<String> - {ok:204} response

Examples
let id = "4e2b9de5-9a73-44f9-8153-bc0904b694c5";

IafPassSvc.deleteOrganization(id);

deleteOrganizationConfigs

Deletes the organizationConfigs by Organization Id

ParameterRequiredTypeDescription
idYesStringThe Organization's UUID.
ctxYesCtxContext, such as namespaces and authentication token information.
Returns

Promise<String> - {ok:204} response

Examples
const organizationConfigs = await deleteOrganizationConfigs(id, ctx);

deletePermission

Deletes a Permission class object when you pass its id.

ParameterRequiredTypeDescription
idYesStringPass the permission's id.
ctxNoCtxContext, such as namespaces and authentication token information.
optionsNoOptionsTo pass headers, pass an object called "options" and add a "headers" property with your headers as the value.
Returns

String - ok:204 response

Examples
IafPassSvc.deletePermission(id);

deletePermissionActions

Deletes specific permission actions based on the provided body content. This function constructs a URL for the deletion endpoint, and performs a DELETE request with the body content specifying which permission actions to remove. The body should detail the actions, service identifier, and resource identifier for which permissions are to be deleted.Authorization: Only trusted clients can call this API.

ParameterRequiredTypeDescription
bodyYesObjectThe body of the request containing the details of the permission actions to delete.
the service identifier (_svc), and the resource identifier (_resource).
ctxNoCtxOptional context object that may include namespaces and authentication token information along with other context-specific data.
This context is used to determine if session storage should be skipped when making the fetch request.
Returns

Promise<void> - A promise that resolves when the deletion operation is complete. If the operation is successful, the promise resolves without any value. If there is an error during the deletion, the promise rejects with an error message.

Examples
// Example of deleting specific permission actions for a 'nameduseritem' resource in the 'itemsvc' service
const body = {
"_svc": "itemsvc",
"_resource": "nameduseritem"
};
await IafPassSvc.deletePermissionActions(body, ctx)
.then(() => console.log('Deletion successful'))
.catch(error => console.error('Deletion failed', error));

deletePermissionProfile

Deletes a PermissionProfile by id

ParameterRequiredTypeDescription
idYesStringPermissionProfile id
ctxYesCtxContext, such as namespaces and authentication token information
Returns

Promise<String> - {ok:204} response

Examples
const response = await deletePermissionProfile(id, ctx);

deleteSecret

Deletes a Secret resource by id.

ParameterRequiredTypeDescription
idYesStringSecret id.
ctxNoCtxContext, such as namespaces and authentication token information.
Returns

Promise<String> - {ok:204} response.

Examples
const secretId = "d2b5f690-7a77-40b2-8fb5-1e271f41d5da";
await IafPassSvc.deleteSecret(secretId, ctx);

deleteUserGroup

Deletes a UserGroup.

ParameterRequiredTypeDescription
idYesStringPass the UserGroup's id.
ctxNoCtxContext, such as namespaces and authentication token information.
Returns

String - ok: 204 response

Examples
const response = await IafPassSvc.deleteUserGroup(id);

deleteUsersFromGroup

Removes Users from a UserGroup. To use this method, the current user should have delete permissions for the group.

ParameterRequiredTypeDescription
idYesStringPass the user group's id.
userIdsYesArray<String>Pass an array with the user ids you want to remove.
ctxNoCtxContext, such as namespaces and authentication token information.
Returns

String - ok: 204 response

Examples
const response = await IafPassSvc.deleteUsersFromGroup(id, userIds);

deleteWorkspace

Soft deletes a Workspace class object.

ParameterRequiredTypeDescription
idYesStringPass the Workspace's id.
ctxNoCtxContext, such as namespaces and authentication token information.
Returns

Promise<String> - {ok:204} response

Examples
IafPassSvc.deleteWorkspace(workspace._id);

downladSecret

Download secret by name, It is accessible the trusted client having proper scope

ParameterRequiredTypeDescription
nameYesStringSecret name.
ctxNoCtxContext, such as namespaces and authentication token information.
Returns

Promise<String> - {ok:204} response.

Examples
const secretName = "OPENAI_API_KEY";
const secretFile = await IafPassSvc.downladSecret(secretName, ctx);

downloadSecret

Download secret by name, It is accessible the trusted client having proper scope

ParameterRequiredTypeDescription
nameYesStringSecret name.
ctxNoCtxContext, such as namespaces and authentication token information.
Returns

Promise<String> - {ok:204} response.

Examples
const secretName = "OPENAI_API_KEY";
const secretFile = await IafPassSvc.downloadSecret(secretName, ctx);

fetchTokens

This Method will be used to get the Access Token and Refresh Token either from the Authorization_Code Grant Type or Authorization_Code With PKCE Grant Type or Using the Refresh Token

ParameterRequiredTypeDescription
configYesObjectOAuth2 token request config. Common fields: , , (optional, only for confidential clients). For the authorization code flow: and optionally (PKCE). For the refresh token flow: and .
ctxYesCtxContext, such as namespaces and authentication token information.
optionsNoanyOptional (merged into the request) and (skips auto session-clear on 401); not OAuth2 params.
Returns

Promise<TokenResponse> - Resolves with the standard OAuth2 token response.

Examples
//Config Example For PKCE:
const config = {
redirectUri: 'http://localhost:4568/digitaltwin',
clientId: '<appId>',
code: 'Auth Code',
codeVerifier: '4cc9b165-1230-4607-873b-3a78afcf60c5',
scope: 'read write',
isRefresh: false
};

//Config Example For authorization_code:
let config = {
redirectUri: 'http://localhost:4568/digitaltwin',
clientId: '<appId>',
code: 'Auth Code',
scope: 'read write',
clientSecret: '<client_secret>'
isRefresh: false
};

Config Example For Refresh Token:
let config = {
redirectUri: 'http://localhost:4568/digitaltwin',
clientId: '<appId>',
code: 'Auth Code',
scope: 'read write',
isRefresh: true,
refreshToken: '<refresh_token>'
};

const tokens = await iafPassSvc.fetchTokens(config, ctx);

// Example response
{
access_token: 'XXXXX',
token_type: 'bearer',
refresh_token: 'XXXXX',
expires_in: 86399,
scope: 'read write',
user_name: 'e3c7a9f7-3cc7-4b25-9617-988594c33f60',
app_id: '448e4ca9-dac9-490f-8d82-f8d4a1cd3100',
jti: 'bc68d113-6565-4564-8e1b-2217eb99d561'
}

getAccountSettingsUrl

Gets the account settings URL for a user interface button you create.

ParameterRequiredTypeDescription
returnUrlNoStringPass the client application's URL to redirect the user to the app after they exit the account settings.
Returns

String - A URL to the account settings

Examples
const url = IafPassSvc.getAccountSettingsUrl('https://general-dev.company.com/ipa-dt')

getAllApplicationConfigs

Get All the Available Application Configs

ParameterRequiredTypeDescription
ctxYesCtx
Returns

Promise<Array<ApplicationConfigs>> - Returns the List of Application config

Examples
const applicationConfigs = await getAllApplicationConfigs(ctx);

getAllOrganizationConfigs

Get All the Available Organization Configs

ParameterRequiredTypeDescription
ctxYesCtx
Returns

Promise<Array<OrganizationConfigs>> - Returns the List of Organization config

Examples
const organizationConfigs = await getAllOrganizationConfigs(ctx);

getAllPermissionProfiles

Get all PermissionProfile class objects from all the pages

ParameterRequiredTypeDescription
criteriaYesPermissionProfileCriteriaPass a JSON object with a Workspace object property, such as "_id" or "_namespaces" or "_name", and enter the value or array of values that you want to filter.
ctxYesCtxContext, such as namespaces and authentication token information
optionsNoPermissionProfileOptionsPass a a JSON object with one or more Page object parameters, such as "_offset" or "_pageSize". The default value for offset is 0 and for page size is 10.
Returns

Promise<Array<PermissionProfile>> -

Examples
const criteria = { _name: 'perm-profile' };

const perms = await getAllPermissionProfiles(criteria, ctx);

getApplication

Gets an Application class object when you pass its id.

ParameterRequiredTypeDescription
idYesStringThe Application's id
ctxNoCtxContext, such as namespaces and authentication token information.
optionsNoGetApplicationOptionsPass an Options object with withConfigs.
Returns

Promise<Application> - A promise with the Application object, 404 response if not found

Examples
const app = await IafPassSvc.getApplication(id);

getApplicationConfigs

Gets ApplicationConfig by applicationId (appId)

ParameterRequiredTypeDescription
idYesStringApplication Id
ctxYesCtxContext, such as namespaces and authentication token information
Returns

Promise<ApplicationConfigs> - Returns the Application config by application Id

Examples
const applicationConfigs = await getApplicationConfigs(id, ctx);
applicationConfigs = {
"usergroups.limit": "5",
"workspaces.limit": "3"
}

getApplications

Gets the session User's applications. Only applications with READ access return.

ParameterRequiredTypeDescription
criteriaYesApplicationCriteriaTo filter your search, pass an Application object with your criteria. This parameter is currently not supported.
ctxNoCtxContext, such as namespaces and authentication token information
optionsNoApplicationOptionsPass an Options object with your offset and page size options. The default value for "_offset" is 0 and for "_pageSize" is 10.
Returns

Promise<Page<Application>> - A promise with a page of Application objects

Examples
let criteria = { namespaces: [...namespaces] };
const applications = await IafPassSvc.getApplications(criteria);

getAppToken

Gets a token for a specific application for a user by exchanging any valid access token. Calls the legacy /v1/auth/token endpoint, proxied to the passportsvc-legacy service.

ParameterRequiredTypeDescription
appIdYesStringThe Application's UUID
ctxNoCtxContext, such as namespaces and authentication token information
Returns

Promise<LegacyAppTokenResponse> - The OAuth2 access token response. No refresh_token is issued.

Examples
const appToken = await IafPassSvc.getAppToken(appId);

getAppToken_v2

Gets a token for a specific application for a user by exchanging any valid access token. Unlike getAppToken (v1), this is handled directly by passportsvc's own OAuth2 Authorization Server (no legacy proxy) and is used when switching applications within a web app.

ParameterRequiredTypeDescription
appIdYesStringThe Application's UUID
ctxNoCtxContext, such as namespaces and authentication token information
Returns

Promise<AppTokenResponse> - The OAuth2 access token response. No scope or refresh_token is issued; appId/user_name/authorities are claims inside the returned JWT, not top-level fields.

Examples
const appToken = await IafPassSvc.getAppToken_v2(appId);

getAuthUrl

Gets an OAuth2 authorization URL for an implicit client.

ParameterRequiredTypeDescription
clientUrlYesStringThe client application's URL that you want to redirect to with an access token after a successful login
appIdYesStringThe platform application's id.
Returns

String - Auth URL as a string

Examples
let url = IafPassSvc.getAuthUrl('https://general-dev.company.com/ipa-dt')

getConfigs

Gets a theme config

ParameterRequiredTypeDescription
ctxNoCtxContext, such as namespaces and authentication token information
Returns

Promise<Object> - Resolves with an object of the form { themes: { login: '<theme_name>' } } describing the configured login theme.

Examples
const configs = await IafPassSvc.getConfigs(ctx);

getCurrentUser

Gets the User class object for a given OAuth token.

ParameterRequiredTypeDescription
ctxNoCtxContext, such as namespaces and authentication token information.
Returns

User - Returns the User object.

Examples
const currentUser = await IafPassSvc.getCurrentUser(ctx);

getNamespaces

Gets authorized namespaces for match your criteria and sorts by namespace for the logged in user.

ParameterRequiredTypeDescription
criteriaYesNamespaceCriteriaPass a JSON object with a criteria _namespace
ctxNoCtxContext, such as namespaces and authentication token information.
optionsNoNamespaceOptionsPass a a JSON object with one or more Page object parameters, such as "_offset" or "_pageSize". The default value for offset is 0 and for page size is 10.
Returns

Promise<Page<Namespace>> - A Page object with the Namespace objects that match your criteria

Examples
// Get namespaces by criteria
const criteria = { _namespace: ["test_EPIr7dyU","test_FROr6dzN"] };
const res1 = await IafPassSvc.getNamespaces(criteria, ctx);

// Get namespaces with options
const criteria = { _namespace: ["test_EPIr7dyU","test_FROr6dzN"] };
const options = { _pageSize: 25, _offset: 0 };
const res2 = await IafPassSvc.getNamespaces(criteria, ctx, options);

getNotificationTemplate

Gets a NotificationTemplate class object.

ParameterRequiredTypeDescription
idYesStringThe NotificationTemplate's UUID
ctxNoCtxContext, such as namespaces and authentication token information
Returns

Promise<NotificationTemplate> - A promise with the NotificationTemplate object

Examples
const notificationTemplate = await IafPassSvc.getNotificationTemplate(id, ctx);

getNotificationTemplates

Gets an application's notification templates that the session user has READ access to.

ParameterRequiredTypeDescription
criteriaNoNotificationTemplateCriteriaTo filter your search, pass a NotificationTemplate object with your criteria.
ctxNoCtxContext, such as namespaces and authentication token information
optionsNoNotificationTemplateOptionsPass an Options object with your offset and page size options. The default value for "_offset" is 0 and for "_pageSize" is 10.
Returns

Promise<Page<NotificationTemplate>> - A promise with a page of NotificationTemplate objects

getOrganization

Gets a Organization when you pass its id.

ParameterRequiredTypeDescription
idYesStringPass the organization's id.
ctxNoCtxContext, such as namespaces and authentication token information.
optionsNoJSONOptional properties, such as withConfigs to include or not
Returns

Promise<Organization> - The Organization object you want. If the Organization method does not find the workspace, a 404 response returns.

getOrganizationConfigs

Gets OrganizationConfig by organization Id

ParameterRequiredTypeDescription
idYesStringOrganization Id
ctxYesCtxContext authentication token information
Returns

Promise<OrganizationConfigs> - Returns the Organization config by organization Id

Examples
const organizationConfigs = await getOrganizationConfigs(id, ctx);
organizationConfigs = {
"applications.limit": "5",
"workspaces.limit": "3",
"usergroups.limit": "10"
}

getOrganizations

Get Organizations for a user

ParameterRequiredTypeDescription
criteriaYesOrganizationCriteriacriteria to filter organizations
ctxNoCtxContext, authentication token information.
optionsNoOrganizationOptionsPass a a JSON object with one or more Page object parameters, such as "_offset" or "_pageSize". The default value for offset is 0 and for page size is 10.
Returns

Promise<Page<Organization>> - A Page object with the Organization objects that match your criteria

Examples
// Get organizations with options
let criteria = {_name: "ABC Organization"}
let options = {_pageSize: 25, _offset: 0}
let res2 = await IafPassSvc.getOrganizations(criteria, ctx, options);

// Get getOrganizations by partial search in name, shorrtname and description
let criteria = {query: "xxxxx"}
let res3 = await IafPassSvc.getOrganizations(criteria, ctx, options);

getOrganizationUsers

Get Organization users

ParameterRequiredTypeDescription
idYesStringPass the organization's id.
criteriaYesOrganizationUserCriteriaIt contains to do wild card search on user's first name,lastname and email
ctxNoCtxContext, authentication token information.
optionsNoOrganizationUserOptionsPass a a JSON object with one or more Page object parameters, such as "_offset" or "_pageSize". The default value for offset is 0 and for page size is 10.
Returns

Promise<Page<User>> - A Page object with the Organization objects that match your criteria

Examples
// Get organization users with query with options
let criteria = {query: "alice"}
let options = {_pageSize: 25, _offset: 0}
let res2 = await IafPassSvc.getOrganizationUsers(id, criteria, ctx, options);

getPasswordPolicies

Gets the platform's password policies.

ParameterRequiredTypeDescription
ctxNoCtxContext, such as namespaces and authentication token information
Returns

Promise<Array<PasswordPolicy>> - Returns a promise with an array of PasswordPolicy objects describing the password validation criteria

Examples
const policies = await IafPassSvc.getPasswordPolicies(ctx);

getPermissionActions

Retrieves permission actions based on specified criteria, context, and options. This function constructs a URL for fetching permission actions from a service, applies criteria for filtering, and includes control options such as pagination settings. It then performs a GET request to the constructed URL.

ParameterRequiredTypeDescription
criteriaYesPermissionActionCriteriaCriteria for filtering permission actions, such as service names or resource types.
This criteria is used to build the query parameters for the request URL.
ctxNoCtxOptional context object that may include authentication token information and other context-specific data.
This context is used to determine if session storage should be skipped when making the fetch request.
optionsNoPermissionActionOptionsOptional additional options for the request, such as pagination settings.
"_offset" specifies the start index for pagination, with a default value of 0 if not provided.
"_pageSize" specifies the number of items per page, with a default value of 10 if not provided.
These options are used to modify the request URL with appropriate query parameters.
Returns

Promise<Array<PermissionActions>> - A promise that resolves to an array of permission actions matching the criteria. Each permission action includes an array of actions (e.g., READ, CREATE, EDIT, DELETE), the service identifier (_svc), and the resource identifier (_resource).

Examples
// Retrieve permission actions for 'itemsvc' service with pagination options
const criteria = { _svc: "itemsvc" };
const options = { _pageSize: 5, _offset: 0 };
const ctx = { authToken: "your_auth_token_here" };
IafPassSvc.getPermissionActions(criteria, ctx, options)
.then(permissionActions => console.log(permissionActions))
.catch(error => console.error(error));

getPermissionById

Gets Permission class objects for Passport Service resources when you pass the Permission's id.

ParameterRequiredTypeDescription
permissionIdYesStringPass the Permission's id.
ctxNoCtxContext, such as namespaces and authentication token information.
Returns

Promise<Permission> - A promise with the Permission object

Examples
let permissionId = "75b2a3d6-a3e8-498d-99dc-23538bc9a389";

IafPassSvc.getPermissionById(permissionId);

getPermissionProfile

Gets a PermissionProfile by its id

ParameterRequiredTypeDescription
idYesStringPermissionProfile id
ctxYesCtxContext, such as namespaces and authentication token information
Returns

Promise<PermissionProfile> - A promise with the PermissionProfile; 404 response if not found

Examples
const permProfile = await getPermissionProfile(id, ctx);

getPermissionProfiles

Gets PermissionProfile class objects by criteria and sorted by _name, _userType and _namespaces

ParameterRequiredTypeDescription
criteriaYesPermissionProfileCriteriaPass a JSON object with a Workspace object property, such as "_id" or "_namespaces" or "_name", and enter the value or array of values that you want to filter.
ctxYesCtxContext, such as namespaces and authentication token information
optionsYesPermissionProfileOptionsoptional parameters such as _offset and _pageSize. By default 0 and 10 respectively
Returns

Promise<Page<PermissionProfile>> - A promise for a Page of created PermissionProfile objects

Examples
const criteria = { _name: 'perm-profile' };
const res2 = await IafPassSvc.getPermissionProfiles(criteria, ctx);

const criteria = { _name: 'perm-profile' };
const options = { _pageSize: 25, _offset: 0 };
const res2 = await IafPassSvc.getPermissionProfiles(criteria, ctx, options);

getPermissions

Gets Permission class objects for Passport Service resources.

ParameterRequiredTypeDescription
criteriaNoPermissionCriteriaPass a PermissionCriteria object with your filter criteria.
ctxNoCtxContext, such as namespaces and authentication token information.
optionsNoPermissionOptionsPass a a JSON object with one or more Page object parameters, such as "_offset" or "_pageSize". The default value for offset is 0 and for page size is 10.
Returns

Page<Permission> - A Page object with the Permission object you want

Examples
let criteria = { _namespace: "ProjA_HEpftR8X",_resourceDesc._irn:"passportsvc:workspace:*" };

let options = { _pageSize: 20 };

const perms = await IafPassSvc.getPermissions(criteria, ctx, options);

getPrincipalInfo

Gets the current User's principal info.

ParameterRequiredTypeDescription
ctxNoCtxContext, such as namespaces and authentication token information
optionsNoOptionsPass an Options object with your offset and page size options.
Returns

PrincipalInfo - Returns a PrincipalInfo object with user information, such as email, first and last name, and user id

Examples
const userInfo = await IafPassSvc.getPrincipalInfo(ctx);

getSecret

Gets a Secret resource when you pass its id.

ParameterRequiredTypeDescription
idYesStringSecret id.
ctxNoCtxContext, such as namespaces and authentication token information.
Returns

Promise<Secret> - A promise with the Secret object.

Examples
const secretId = "d2b5f690-7a77-40b2-8fb5-1e271f41d5da";
const secret = await IafPassSvc.getSecret(secretId, ctx);

getSecrets

Gets Secret resources by criteria.

ParameterRequiredTypeDescription
criteriaYesSecretCriteriaCriteria to filter Secrets.
ctxNoCtxContext, such as namespaces and authentication token information.
optionsNoSecretOptionsOptional query parameters, such as pagination.
Returns

Promise<Page<Secret>> - A promise with a page of Secret objects.

Examples
const criteria = { _name: "OPENAI_API_KEY"};
const options = { _pageSize: 25, _offset: 0 };
const secretsPage = await IafPassSvc.getSecrets(criteria, ctx, options);

getSessionLogoutUrl

Gets a logout URL to log out a user's Passport Service session.

ParameterRequiredTypeDescription
clientIdYesStringThe Application's client ID (UUID).
redirectUriYesStringThe URL to redirect to after logout. Must be one of the Application's registered post-logout redirect URIs.
Returns

String - Logout URL as a string

Examples
let url = IafPassSvc.getSessionLogoutUrl('4eb0ea70-0cf6-4457-9493-6417828fb597', 'https://general-dev.company.com/ipa-dt')

getUserById

Gets a User class object when you pass its id.

ParameterRequiredTypeDescription
userIdYesStringPass the User object's id.
ctxNoCtxContext, such as namespaces and authentication token information.
Returns

Promise<User> - A promise with the User object

Examples
const user = await IafPassSvc.getUserById(id);

getUserGroup

Gets a UserGroup class object by id.

ParameterRequiredTypeDescription
idYesStringPass the UserGroup's id.
ctxNoCtxContext, such as namespaces and authentication token information.
Returns

Promise<UserGroup> - A promise with the UserGroup object

Examples
const userGroup = await IafPassSvc.getUserGroup(id);

getUserGroupInvite

Gets the details of a sent user group Invite object.

ParameterRequiredTypeDescription
groupIdYesStringThe UserGroup's UUID
inviteIdYesStringThe Invite's UUID
ctxNoCtxContext, such as namespaces and authentication token information
Returns

Invite - The Invite object

Examples
const invite = await IafPassSvc.getUserGroupInvite(groupId, inviteId);

getUserGroupInvites

Gets a user group's sent member Invites.

ParameterRequiredTypeDescription
userGroupIdYesStringPass the UserGroup's id.
criteriaYesInviteCriteriaFilter the invites by the following statuses: PENDING, EXPIRED, ACCEPTED, CANCELLED, REJECTED.
ctxYesCtxContext, such as namespaces and authentication token information
optionsYesInviteOptionsPass an InviteOptions object with your pagination options.
Returns

Promise<Page<Invite>> - A promise with a page of Invite objects

Examples
const criteria = { _status: ["PENDING"] };
const options = { _pageSize: 30 };

const invites = await IafPassSvc.getUserGroupInvites(userGroup._id, criteria);

getUsergroupPermissions

Get permissions for usergroup

ParameterRequiredTypeDescription
idYesStringPass the UserGroup's id.
ctxNoCtxContext, such as namespaces and authentication token information.
optionsNoJSONOptions
Returns

Promise<Page<Permission>> - A promise with a Page object that contains the User objects you want

Examples
const permissions = await IafPassSvc.getUsergroupPermissions(id);

getUserGroups

Retrieve all the UserGroup objects that the user is a member of by default. Use includeAll as true to retrieve both the user groups of which the user is a part and those for which the user has 'READ' access.

ParameterRequiredTypeDescription
criteriaYesUserGroupCriteriaPass a UserGroup object with the properties and values you define.
ctxNoCtxContext, such as namespaces and authentication token information.
optionsNoUserGroupCriteriaOptionsPass one or more Page object parameters, such as "_offset" and "_pageSize", as a JSON object. The default value for offset is 0 and for page size is 10.
Returns

Promise<Page<UserGroup>> - A promise with a Page object that contains the UserGroup objects that match your criteria

Examples
// Get user groups by criteria
let criteria = { _id: [...ids], _userType: "project" };
let res = await IafPassSvc.getUserGroups(criteria, ctx);

// Get user groups with options
let criteria = { _userType: [ "project", "user_group" ] };
let options = { _pageSize: 25, _offset: 0 };
let res = await IafPassSvc.getUserGroups(criteria, ctx, options);

// Retrieve both usergroups which user is part of and user has 'READ' access
let criteria = {};
let options = { includeAll: true };
let res2 = await IafPassSvc.getUserGroups(criteria, ctx, options);

// Get user groups by partial search
let criteria = { query: "project" };
let res3 = await IafPassSvc.getUserGroups(criteria, ctx, options);

getUserInvites

Get the current user's invites.

ParameterRequiredTypeDescription
criteriaYesInviteCriteriaFilter the invites by the following statuses: PENDING, EXPIRED, ACCEPTED, CANCELLED, REJECTED.
ctxNoCtxContext, such as namespaces and authentication token information.
optionsYesInviteOptionsPass an InviteOptions object with your pagination options.
Returns

Promise<Array<Invite>> - A promise with an array of Invite class objects for the user

Examples
let criteria = {_status: ["PENDING"]};
let options = {_pageSize: 30};

const invites = await IafPassSvc.getUserInvites(criteria, ctx);

getUsersInGroup

Gets a UserGroup's users.

ParameterRequiredTypeDescription
idYesStringPass the UserGroup's id.
ctxNoCtxContext, such as namespaces and authentication token information.
optionsNoUserGroupUserOptionsPass one or more Page object parameters, such as "_offset" and "_pageSize", as a JSON object. The default value for offset is 0 and for page size is 10.
Returns

Promise<Page<User>> - A promise with a Page object that contains the User objects you want

Examples
const users = await IafPassSvc.getUsersInGroup(id);

getWorkspace

Gets a Workspace class object when you pass its id.

ParameterRequiredTypeDescription
idYesStringPass the Workspace object's id.
ctxNoCtxContext, such as namespaces and authentication token information.
Returns

Promise<Workspace> - The Workspace object you want. If the workspace method does not find the workspace, a 404 response returns.

Examples
const workspace = await IafPassSvc.getWorkspace(id, ctx);

getWorkspaces

Gets Workspace class objects that match your criteria and sorts by name for the logged in user.

ParameterRequiredTypeDescription
criteriaYesWorkspaceCriteriaPass a JSON object with a Workspace object property, such as "_id" or "_namespaces", and enter the value or array of values that you want to filter.
ctxNoCtxContext, such as namespaces and authentication token information.
optionsNoWorkspaceCriteriaOptionsPass a a JSON object with one or more Page object parameters, such as "_offset" or "_pageSize". The default value for offset is 0 and for page size is 10.
Returns

Promise<Page<Workspace>> - A Page object with the Workspace objects that match your criteria

Examples
// Get workspaces by criteria
const criteria = { _id: [...ids], _userType: "project" };
const res1 = await IafPassSvc.getWorkspaces(criteria, ctx);

// Get workspaces with options
const criteria = { _userType: ["project", "user_group"] };
const options = { _pageSize: 25, _offset: 0 };
const res2 = await IafPassSvc.getWorkspaces(criteria, ctx, options);

// Get workspaces by partial search
const criteria = { query: "project" };
const res3 = await IafPassSvc.getWorkspaces(criteria, ctx, options);

hardDeleteUserGroup

Hard deletes a UserGroup.

ParameterRequiredTypeDescription
idYesStringPass the UserGroup's id.
ctxNoCtxContext, such as namespaces and authentication token information.
Returns

String - ok: 204 response

Examples
const response = await IafPassSvc.hardDeleteUserGroup(id);

hardDeleteWorkspace

Permanently deletes a Workspace class object.

ParameterRequiredTypeDescription
idYesStringPass the Workspace's id.
ctxNoCtxContext, such as namespaces and authentication token information.
Returns

Promise<String> - {ok:204} response

Examples
IafPassSvc.hardDeleteWorkspace(workspace._id);

inviteUsersToGroup

Sends invite links to users to join a user group. To use this method, the current user should have edit permissions for the group. You can send a maximum of 25 invites at a time.

ParameterRequiredTypeDescription
idYesStringThe user group's id
invitesYesArray<Invite>Pass an array of Invite object with your invite details.
ctxYesCtxContext, such as namespaces and authentication token information
Returns

Array<Invite> - The array of sent invites

Examples
let invites = [{_email: "user1@mail.com"}, {_email: "user2@mail.com"}, {_email: "user3@mail.com"}];

const result = await IafPassSvc.inviteUsersToGroup(id, invites, ctx);

logout

Logs out the current user and invalidates the Auth token.

ParameterRequiredTypeDescription
ctxNoCtxContext, such as namespaces and authentication token information.
Returns

Promise<void> -

Examples
IafPassSvc.logout(ctx);

partialUpdateApplicationConfigs

Updates the applicationConfigs by applicationId (appId)

ParameterRequiredTypeDescription
idYesStringThe Application's UUID.
applicationConfigsYesApplicationConfigsConfigs to create or update; keys not included are left unchanged. Supported keys: , , e.g. { "usergroups.limit": "5" }.
ctxYesCtxContext, such as namespaces and authentication token information.
Returns

Promise<ApplicationConfigs> - Returns the Application config by application Id

Examples
const applicationConfigs = await partialUpdateApplicationConfigs(id, applicationConfigs, ctx);
* applicationConfigs = {
"usergroups.limit": "5",
}

partialUpdateOrganizationConfigs

Updates the organizationConfigs by OrganizationId

ParameterRequiredTypeDescription
idYesStringThe Organization's UUID.
organizationConfigsYesOrganizationConfigsConfigs to create or update; keys not included are left unchanged. Supported keys: , , , e.g. { "applications.limit": "5" }.
ctxYesCtxContext, such as namespaces and authentication token information.
Returns

Promise<OrganizationConfigs> - Returns the Organization config by Organization Id

Examples
const organizationConfigs = await partialUpdateOrganizationConfigs(id, organizationConfigs, ctx);
applicationConfigs = {
"applications.limit": "5",
}

PlatformRoles

The platform's built-in roles. Each entry maps a role to the used to identify the corresponding UserGroup.

Type: Object

PropertyTypeDescription
PlatformManagerObject- Manages the platform across all organizations.
ORG_OWNERObject- Owns and manages a single organization.
APP_OWNERObject- Owns and manages a single application.
APP_DEVELOPERObject- Default user group for an application's developers.

updateApplication

Updates an Application's information, such as its name, description, app owner, and namespaces.

ParameterRequiredTypeDescription
idYesStringThe Application's id
appYesApplicationPass an Application object with your updates.
ctxNoCtxContext, such as namespaces and authentication token information
Returns

Promise<Application> - The updated Application object

Examples
app._appOwner = user._id;

const updateApp = await IafPassSvc.updateApplication(id, app);

updateApplicationConfigs

Creates or Updates (replaces) the applicationConfigs by applicationId (appId)

ParameterRequiredTypeDescription
idYesStringThe Application's UUID.
applicationConfigsYesApplicationConfigsConfigs to set, replacing any existing configs. Supported keys: , , e.g. { "usergroups.limit": "5", "workspaces.limit": "3" }.
ctxYesCtxContext, such as namespaces and authentication token information.
Returns

Promise<ApplicationConfigs> - Returns the Application config by application Id

Examples
const applicationConfigs = await updateApplicationConfigs(id, applicationConfigs, ctx);

applicationConfigs = {
"usergroups.limit": "5",
"workspaces.limit": "3"
}

updateNotificationTemplate

Updates a NotificationTemplate class object.

ParameterRequiredTypeDescription
idYesStringThe NotificationTemplate's UUID
notificationTemplateYesNotificationTemplatePass a NotificationTemplate object with your updates.
ctxNoCtxContext, such as namespaces and authentication token information
Returns

Promise<NotificationTemplate> - A promise with the updated NotificationTemplate object

Examples
notificationTemplate._message = "Click the following link to join the application. If you received this message by mistake, please conntact your administator";

IafPassSvc.updateNotificationTemplate(id, notificationTemplate);

updateOrganization

Updates an existing organization.

ParameterRequiredTypeDescription
idYesStringPass the organization's id.
organizationYesOrganizationPass a Organization JSON object with the properties and values you want to update.
ctxNoCtxContext, such as namespaces and authentication token information.
Returns

Promise<Organization> - A promise with the updated Organization object

Examples
let id = "4e2b9de5-9a73-44f9-8153-bc0904b694c5";

let organization = {
"_description": "Organization A new description",
"_name": "Organization A new name"
},

IafPassSvc.updateOrganization(id, organization);

updateOrganizationConfigs

Creates or Updates (replaces) the OrganizationConfigs by orgId

ParameterRequiredTypeDescription
idYesStringThe Organization's UUID.
organizationConfigsYesOrganizationConfigsConfigs to set, replacing any existing configs. Supported keys: , , , e.g. { "applications.limit": "5", "workspaces.limit": "3", "usergroups.limit": "10" }.
ctxYesCtxContext, such as namespaces and authentication token information.
Returns

Promise<OrganizationConfigs> - Returns the Organization configs by Organization Id

Examples
const organizationConfigs = await updateOrganizationConfigs(id, organizationConfigs, ctx);

organizationConfigs = {
"applications.limit": "5",
"workspaces.limit": "3",
"usergroups.limit": "10"
}

updatePermissionProfile

Updates a PermissionProfile class object

ParameterRequiredTypeDescription
idYesStringPermissionProfile id
permissionProfileYesPermissionProfileThe updated PermissionProfile object
ctxYesCtxContext, such as namespaces and authentication token information
Returns

Promise<PermissionProfile> - The updated PermissionProfile

Examples
permProfile._namespaces = project._namespaces;

const updatedPermProf = await updatePermissionProfile(id, permProfile, ctx);

updatePermissions

Updates multiple permissions for passport service resources. If a Permission object you pass doesn't exist, the method creates it. The method uses the "_resourceDesc", "_namespace", and "_user" fields to identify if a permission exists.

ParameterRequiredTypeDescription
permissionsYesArray<Permission>Pass an array of the Permission objects with your updates.
ctxNoCtxContext, such as namespaces and authentication token information.
optionsNoOptionsPass a a JSON object with one or more Page object parameters, such as "_offset" or "_pageSize". The default value for offset is 0 and for page size is 10.
Returns

CreatePermissionsResponse - A CreatePermissionsResponse object with with separate arrays of the successful and failed permissions

Examples
let permissions = [
{
_actions: [
IafPermission.PermConst.Action.Read,
IafPermission.PermConst.Action.Share,
IafPermission.PermConst.Action.Delete
],
_namespace: "ProjA_HEpftR8X",
_resourceDesc: {
_irn: IafPermission.NamedUserItemIrnAll
},
_user: {
_id: "75b2a3d6-a3e8-498d-99dc-23538bc9a389", // Either user or usergroup id, specify respective _type
_type: IafPermission.PermConst.UserType.User // Either user or usergroup, specify respective _id
}
},
{
_actions: [
IafPermission.PermConst.Action.SHARE,
],
_namespace: "ProjB_SDprfS4R",
_resourceDesc:{
_irn: IafPermission.NamedUserItemIrnAll
},
_user :{
_id: "75b2a3d6-a3e8-498d-99dc-23538bc9a389", // Either user or usergroup id, specify respective _type
_type: IafPermission.PermConst.UserType.User // Either user or usergroup, specify respective _id
}
}
];

const updatedPerms = await IafPassSvc.updatePermissions(permissions);

updateSecret

Updates an existing Secret resource.

ParameterRequiredTypeDescription
idYesStringSecret id.
secretYesSecretSecret object with the properties and values you want to update.
ctxNoCtxContext, such as namespaces and authentication token information.
Returns

Promise<Secret> - A promise with the updated Secret object.

Examples
const secretId = "d2b5f690-7a77-40b2-8fb5-1e271f41d5da";
const updates = { _description: "Rotated on 2024-05-12", _value: "n3wV@lu3" };
const updatedSecret = await IafPassSvc.updateSecret(secretId, updates, ctx);

updateUser

Updates a User class object. Users can update their own data but not another's.

ParameterRequiredTypeDescription
userYesUserPass a User object with the properties and values you want to update.
ctxNoCtxContext, such as namespaces and authentication token information.
Returns

Promise<User> - The updated User object

Examples
user._email = "updated_email@mail.com"

const updatedUser = await IafPassSvc.updateUser(user);

updateUserGroup

Updates a UserGroup class object.

ParameterRequiredTypeDescription
idYesStringThe UserGroup's id
userGroupYesUserGroupPass a defined UserGroup object with the properties and values you want to update
ctxYesCtxContext, such as namespaces and authentication token information
Returns

Promise<UserGroup> - The updated UserGroup object

Examples
userGroup._name = "new user group name";

const updatedUserGroup = await IafPassSvc.updateUserGroup(id, userGroup);

updateUserGroupInvite

Updates a user group Invite, such as the Invite's status of PENDING, EXPIRED, ACCEPTED, CANCELLED, or REJECTED.

ParameterRequiredTypeDescription
userGroupIdYesStringThe UserGroup's id
inviteIdYesStringThe Invite's id
inviteYesInvitePass an Invite object with your updates.
ctxNoCtxContext, such as namespaces and authentication token information
Returns

Promise<String> - {ok:204} response

Examples
let invite = { _status: "REJECTED" };

const response = await IafPassSvc.updateUserGroupInvite('35fefa76-70be-429a-b403-9ccb0e814ed9', '3f1126a9-c14e-4541-a2bf-5f1367620df0', invite);

updateWorkspace

Updates an existing Workspace class object.

ParameterRequiredTypeDescription
idYesStringPass the Workspace's id.
workspaceYesWorkspacePass a Workspace JSON object with the properties and values you want to update.
ctxNoCtxContext, such as namespaces and authentication token information.
Returns

Promise<Workspace> - A promise with the updated Workspace object

Examples
const workspace = {
_description: "Project A workspace new description",
_name: "Project A new name",
_shortName: "Proj_A_new",
_userType: "project_workspace"
};

const updatedWorkspace = await IafPassSvc.updateWorkspace(id, workspace);

upsertPermissionActions

Creates or updates permission actions by sending permission action objects to the server. This operation, often referred to as "upsert", either inserts new permission actions if they do not already exist, or updates them if they do. The decision to create or update is typically based on the uniqueness of the permission action combination of service identifier (_svc) and resource identifier (_resource).Authorization: Only trusted clients can call this API.

ParameterRequiredTypeDescription
permissionActionsYesPermissionActionspermission action objects to be created or updated.
Each object in this array should include at least the service identifier (_svc) and the resource identifier (_resource),
along with any specific actions (e.g., READ, CREATE, EDIT, DELETE) to be associated with the resource for the service.
ctxNoCtxOptional context object that may include namespaces, authentication token information, and other context-specific data.
This context is utilized for authentication and authorization purposes, ensuring that the request is performed within the correct security context.
optionsNoOptionsPass a a JSON object with one or more Page object parameters, such as "_offset" or "_pageSize". The default value for offset is 0 and for page size is 10.
Returns

Promise<PermissionActions> - A promise that resolves to the created or updated permission action objects. The structure of each object in the returned array mirrors that of the input object, potentially augmented with additional information such as creation timestamps or identifiers if the operation resulted in new objects being created.

Examples
// Example of upserting permission actions for a 'nameduseritem' resource in the 'itemsvc' service
const permissionActions = {
"_svc": "itemsvc",
"_resource": "nameduseritem",
"_actions": ["READ", "CREATE", "EDIT", "DELETE"]
};
IafPassSvc.upsertPermissionActions(permissionActions, ctx)
.then(updatedActions => console.log('Upsert successful', updatedActions))
.catch(error => console.error('Upsert failed', error));