Skip to main content
Version: v4.5

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
ctxYesCtxContext, such as namespaces and authentication token information - Optional
Returns

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

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

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
optionsYesany
Examples
{ "_id":"94a1eb2b-06bd-426e-a3ce-e7ab609ea231",  "_name": "DigitalTwin",  "_appOwner": "[email protected]",  "_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
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"    _appId: "68595r24-4cf5-4587-3325-955ac7a65872"  },  {    _name: "app2_invite"    _title: "Invitaion to join Application 2"    _message: "Click the following link to join the application:"    _format: "text"    _appId: "99663r24-4cf5-7878-4646-955ac7a55688"  }];
const notificationTemplates = 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": "[email protected]","_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.
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
// Permissions with mandatory fieldsconst 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 = IafPermission.createPassPermissions(permissions, ctx);
// Permissions with criteriaconst 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);

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 loginconst body = {  _firstname: "John",  _lastname: "Doe",  _email: "[email protected]",  _password: "Test@123",  _tempPassword: true};
const user = await IafPassSvc.create(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()    },  },};
IafPassSvc.createWorkspace(workspaces);

deleteApplicationConfigs#

Deletes the applicationConfigs by applicationId (appId)

ParameterRequiredTypeDescription
idYesString
ctxYesCtx
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);

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.

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' serviceconst body = {  "_svc": "itemsvc",  "_resource": "nameduseritem"};await IafPassSvc.deletePermissionActions(body, ctx)  .then(() => console.log('Deletion successful'))  .catch(error => console.error('Deletion failed', error)); Authorization: Only Trusted clients can make this API

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);

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);

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
configYesObject
ctxYesCtxContext, such as namespaces and authentication token information.
optionsYesany
Examples
//Config Example For PKCE: cosnt 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);

getAllPermissionProfiles#

Get all PermissionProfile class objects.

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
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<Array<PermissionProfile>> -

Examples
const criteria = {  _namespaces: project._namespaces};
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.
optionsYesundefined
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
idYesString
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
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<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.

ParameterRequiredTypeDescription
appIdYesStringThe Application's UUID
ctxNoCtxContext, such as namespaces and authentication token information
Examples
const appToken = await IafPassSvc.getAppToken(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
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);

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
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<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.
Returns

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

getOrganizations#

Get Organizations for a user

ParameterRequiredTypeDescription
criteriaYesOrganizationCriteriacriteria to filter organizations
ctxNoCtxContext, 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

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 descriptionlet criteria = {query: "xxxxx"}let res3 = await IafPassSvc.getOrganizations(criteria, ctx, options);

getOrganizationUsers#

Get Organization users

ParameterRequiredTypeDescription
idYesundefined
criteriaYesObjectIt contains to do wild card search on user's first name,lastname and email
ctxNoCtxContext, 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

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 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);

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
criteriaYesObjectCriteria 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.
optionsNoOptionsOptional 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 optionsconst 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
optionsYesOptionsoptional 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.
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

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

Examples
let criteria = { _namespace: "ProjA_HEpftR8X" };    
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);

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);

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.
optionsNoOptionsPass 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 criterialet criteria = { _id: [...ids], _userType: "project" };let res = await IafPassSvc.getUserGroups(criteria, ctx);
// Get  user groups  with optionslet 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' accesslet criteria = {};let options = { includeAll: true };let res2 = await IafPassSvc.getUserGroups(criteria, ctx, options);
// Get user groups  by partial searchlet 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.
optionsNoJSONPass 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<Workpace> - 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.
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<Page<Workspace>> - A Page object with the Workspace objects that match your criteria

Examples
// Get workspaces by criteriaconst criteria = { _id: [...ids], _userType: "project" };const res1 = await IafPassSvc.getWorkspaces(criteria, ctx);
// Get workspaces with optionsconst criteria = { _userType: ["project", "user_group"] };const options = { _pageSize: 25, _offset: 0 };const res2 = await IafPassSvc.getWorkspaces(criteria, ctx, options);
// Get workspaces by partial searchconst 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: "[email protected]"}, {_email: "[email protected]"}, {_email: "[email protected]"}];
const invites = await IafPassSvc.inviteUsersToGroup(id, invites);

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
idYesString
applicationConfigsYesApplicationConfigs
ctxYesCtx
Returns

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

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

PlatformRoles#

Platform role and respective usertype which is used identify the usergroup.

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
idYesString
applicationConfigsYesApplicationConfigs
ctxYesCtx
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<Workspace> - 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);

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);

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 = "[email protected]"  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 updated userGroup = 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(userGroup._id, invite._id, 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).

ParameterRequiredTypeDescription
permissionActionsYesundefined
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.
Examples
// Example of upserting permission actions for a 'nameduseritem' resource in the 'itemsvc' serviceconst 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)); Authorization: Only Trusted clients can make this API