Show / Hide Table of Contents

Class NSUserAgent

User administration.

Syntax
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

Constructors

NSUserAgent()

User administration.

Declaration
NSUserAgent
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

Methods

AddOwnerContact(Integer)

User administration.

Declaration
Void AddOwnerContact(Integer contactId)
Parameters
Type Name Description
Integer contactId
Returns
Type Description
Void
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

CanChangePassword(Integer)

Checks if the current associate can change the password for an associate

Declaration
Bool CanChangePassword(Integer associateId)
Parameters
Type Name Description
Integer associateId
Returns
Type Description
Bool
Examples
NSUserAgent agent;
Integer associateId;
Bool res = agent.CanChangePassword(associateId);

ChangeOwnPassword(String,String)

Changes password for a user.

Declaration
Bool ChangeOwnPassword(String oldPassword, String newPassword)
Parameters
Type Name Description
String oldPassword
String newPassword
Returns
Type Description
Bool
Examples
NSUserAgent agent;
String oldPassword;
String newPassword;
Bool res = agent.ChangeOwnPassword(oldPassword, newPassword);

ChangePassword(Integer,String,String)

Changes password for a user.

Declaration
Bool ChangePassword(Integer associateId, String oldPassword, String newPassword)
Parameters
Type Name Description
Integer associateId
String oldPassword
String newPassword
Returns
Type Description
Bool
Examples
NSUserAgent agent;
Integer associateId;
String oldPassword;
String newPassword;
Bool res = agent.ChangePassword(associateId, oldPassword, newPassword);

ChangePasswordFromName(String,String,String)

Changes password for a user.

Declaration
Bool ChangePasswordFromName(String associateName, String oldPassword, String newPassword)
Parameters
Type Name Description
String associateName
String oldPassword
String newPassword
Returns
Type Description
Bool
Examples
NSUserAgent agent;
String associateName;
String oldPassword;
String newPassword;
Bool res = agent.ChangePasswordFromName(associateName, oldPassword, newPassword);

ChangeUserType(NSUser,Integer)

Gets a user from the user name.

Declaration
NSUser ChangeUserType(NSUser user, Integer userType)
Parameters
Type Name Description
NSUser user
Integer userType
Returns
Type Description
NSUser
Examples
NSUserAgent agent;
NSUser user;
Integer userType;
NSUser res = agent.ChangeUserType(user, userType);

CheckAccessGatewayRegistration()

Checks if AccessGatewayRegistration is valid

Declaration
Bool CheckAccessGatewayRegistration()
Returns
Type Description
Bool
Examples
NSUserAgent agent;
Bool res = agent.CheckAccessGatewayRegistration();

CreateDefaultRoleEntity()

Sets default values into a new NSRoleEntity.

Declaration
NSRoleEntity CreateDefaultRoleEntity()
Returns
Type Description
NSRoleEntity
Remarks

NetServer calculates default values (for example, Country) on the entity, which is required when creating/storing a new instance

Examples
NSUserAgent agent;
NSRoleEntity thing = agent.CreateDefaultRoleEntity();
thing = agent.SaveRoleEntity(thing);

CreateDefaultRoleEntityFromType(Integer)

Creates a new role entity of the specified role type. The role type cannot be changed after the entity is created.

Declaration
NSRoleEntity CreateDefaultRoleEntityFromType(Integer type)
Parameters
Type Name Description
Integer type

See RoleType.

Returns
Type Description
NSRoleEntity
Examples
NSUserAgent agent;
Integer type;
NSRoleEntity res = agent.CreateDefaultRoleEntityFromType(type);

CreateDefaultServiceAuth()

Sets default values into a new NSServiceAuth.

Declaration
NSServiceAuth CreateDefaultServiceAuth()
Returns
Type Description
NSServiceAuth
Remarks

NetServer calculates default values (for example, Country) on the entity, which is required when creating/storing a new instance

Examples
NSUserAgent agent;
NSServiceAuth thing = agent.CreateDefaultServiceAuth();
thing = agent.SaveServiceAuth(thing);

CreateDefaultUntrustedCredentials()

Sets default values into a new NSUntrustedCredentials.

Declaration
NSUntrustedCredentials CreateDefaultUntrustedCredentials()
Returns
Type Description
NSUntrustedCredentials
Remarks

NetServer calculates default values (for example, Country) on the entity, which is required when creating/storing a new instance

Examples
NSUserAgent agent;
NSUntrustedCredentials thing = agent.CreateDefaultUntrustedCredentials();
thing = agent.SaveUntrustedCredentials(thing);

CreateDefaultUser()

Sets default values into a new NSUser.

Declaration
NSUser CreateDefaultUser()
Returns
Type Description
NSUser
Remarks

NetServer calculates default values (for example, Country) on the entity, which is required when creating/storing a new instance

Examples
NSUserAgent agent;
NSUser thing = agent.CreateDefaultUser();
thing = agent.SaveUser(thing);

CreateDefaultUserFromUserType(Integer)

Creates default NSUser providing the user type. Only System and Anonymous users can be created without an existing person.

Declaration
NSUser CreateDefaultUserFromUserType(Integer userType)
Parameters
Type Name Description
Integer userType

See AssociateType.

Returns
Type Description
NSUser
Remarks

Use CreateDefaultUserFromUserTypeAndPersonId to create internal (i.e. Employee) or external users.

Examples
NSUserAgent agent;
Integer userType;
NSUser res = agent.CreateDefaultUserFromUserType(userType);

CreateDefaultUserFromUserTypeAndCredential(Integer,Integer,String,String,String)

Creates an NSPersonEntity with default values based on the contactId and credentials.

Declaration
NSUser CreateDefaultUserFromUserTypeAndCredential(Integer userType, Integer contactId, String credentialType, String credentialValue, String credentialDisplayValue)
Parameters
Type Name Description
Integer userType

See AssociateType

Integer contactId
String credentialType
String credentialValue
String credentialDisplayValue
Returns
Type Description
NSUser
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

CreateDefaultUserFromUserTypeAndPersonId(Integer,Integer)

Creates default NSUser providing the associate type and person id. System and Anonymous users can be created without an existing person and permits person id to be 0.

Declaration
NSUser CreateDefaultUserFromUserTypeAndPersonId(Integer userType, Integer personId)
Parameters
Type Name Description
Integer userType

See AssociateType

Integer personId
Returns
Type Description
NSUser
Examples
NSUserAgent agent;
Integer userType;
Integer personId;
NSUser res = agent.CreateDefaultUserFromUserTypeAndPersonId(userType, personId);

CreateExternalUser(Integer,String,String,Integer,Bool)

Creates an associate of type external user.

Declaration
Integer CreateExternalUser(Integer personId, String userName, String password, Integer roleId, Bool isActive)
Parameters
Type Name Description
Integer personId
String userName
String password
Integer roleId
Bool isActive
Returns
Type Description
Integer
Examples
NSUserAgent agent;
Integer personId;
String userName;
String password;
Integer roleId;
Bool isActive;
Integer res = agent.CreateExternalUser(personId, userName, password, roleId, isActive);

CreateUserGroup()

Creates UserGroup (Rank is assigned to the highest rank)

Declaration
NSUserGroup CreateUserGroup()
Returns
Type Description
NSUserGroup
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

DecryptAndSaveExternalTokens(NSTokenManagementInfo)

First asks AccessGateway to decrypt the tokens, then saves the external tokens to the DB and returns a key that can be used to retrieve them

Declaration
String DecryptAndSaveExternalTokens(NSTokenManagementInfo tokenManagementInfo)
Parameters
Type Name Description
NSTokenManagementInfo tokenManagementInfo
Returns
Type Description
String
Examples
NSUserAgent agent;
NSTokenManagementInfo tokenManagementInfo;
String res = agent.DecryptAndSaveExternalTokens(tokenManagementInfo);

DeleteCredential(Integer,String)

Removes credential of a specific type for a user

Declaration
Bool DeleteCredential(Integer userId, String credentialType)
Parameters
Type Name Description
Integer userId
String credentialType
Returns
Type Description
Bool
Examples
NSUserAgent agent;
Integer userId;
String credentialType;
Bool res = agent.DeleteCredential(userId, credentialType);

DeleteExternalUser(Integer)

Deletes an associate of type external user.

Declaration
Void DeleteExternalUser(Integer associateId)
Parameters
Type Name Description
Integer associateId
Returns
Type Description
Void
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

DeleteRole(Integer,Integer)

Deletes the specified role and move all users associated with the role to the replacingRoleId

Declaration
Void DeleteRole(Integer roleIdToDelete, Integer replacingRoleId)
Parameters
Type Name Description
Integer roleIdToDelete
Integer replacingRoleId
Returns
Type Description
Void
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

DeleteServiceAuth(Integer)

Deletes the NSServiceAuth

Declaration
DeleteServiceAuth(Integer serviceAuth)
Parameters
Type Name Description
Integer serviceAuth
Returns
Type Description
Void
Examples
NSUserAgent agent;
agent.DeleteServiceAuth(123);

DeleteUser(Integer)

Deletes the NSUser

Declaration
DeleteUser(Integer user)
Parameters
Type Name Description
Integer user
Returns
Type Description
Void
Examples
NSUserAgent agent;
agent.DeleteUser(123);

DeleteUserFromName(String)

Deletes a user, with lookup based on the user name.

Declaration
Void DeleteUserFromName(String userName)
Parameters
Type Name Description
String userName
Returns
Type Description
Void
Examples
NSUserAgent agent;
String userName;
agent.DeleteUserFromName(userName);

DeleteUserGroup(Integer,Integer)

Deletes a user group and move its members to another user group

Declaration
Void DeleteUserGroup(Integer userGroupToDelete, Integer userGroupToMoveTo)
Parameters
Type Name Description
Integer userGroupToDelete
Integer userGroupToMoveTo
Returns
Type Description
Void
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

FindCredentialsGroups(String,String)

Gets user groups holding users filtered by the searchString.

Declaration
NSCredentialsGroup[] FindCredentialsGroups(String type, String searchString)
Parameters
Type Name Description
String type
String searchString
Returns
Type Description
NSCredentialsGroup[]

There will always be at least one groups even if the underlying provider does not support groups.

Remarks

This method is only relevant if the CredentialType control is of type link.

Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

FindCredentialUsers(String,String)

Find users matching the partial name.

Declaration
NSCredentialsGroupUsers FindCredentialUsers(String type, String searchString)
Parameters
Type Name Description
String type
String searchString
Returns
Type Description
NSCredentialsGroupUsers
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

FindRolesWithFunctionalRight(String)

Finds all roles with a given functional right. The roles matched must contain the specified functional right.

Declaration
NSMDOListItem[] FindRolesWithFunctionalRight(String functionalRightName)
Parameters
Type Name Description
String functionalRightName
Returns
Type Description
NSMDOListItem[]
Examples
NSUserAgent agent;
String functionalRightName;
NSMDOListItem[] res = agent.FindRolesWithFunctionalRight(functionalRightName);

FindRolesWithFunctionalRights(String[])

Finds all roles with a given set of functional rights. The roles matched must contain one or more of the specified functional rights.

Declaration
Integer[] FindRolesWithFunctionalRights(String[] functionalRightNames)
Parameters
Type Name Description
String[] functionalRightNames
Returns
Type Description
Integer[]
Examples
NSUserAgent agent;
String[] functionalRightNames;
Integer[] res = agent.FindRolesWithFunctionalRights(functionalRightNames);

FindRolesWithoutFunctionalRights(String[])

Finds all roles without a given set of functional rights. The roles matched must not contain any of the specified functional rights.

Declaration
Integer[] FindRolesWithoutFunctionalRights(String[] functionalRightNames)
Parameters
Type Name Description
String[] functionalRightNames
Returns
Type Description
Integer[]
Examples
NSUserAgent agent;
String[] functionalRightNames;
Integer[] res = agent.FindRolesWithoutFunctionalRights(functionalRightNames);

GenerateNewPasswordForExternalUser(String)

Generates a new password for an external user.

Declaration
String GenerateNewPasswordForExternalUser(String associateName)
Parameters
Type Name Description
String associateName
Returns
Type Description
String
Examples
NSUserAgent agent;
String associateName;
String res = agent.GenerateNewPasswordForExternalUser(associateName);

GetAccessGatewayInfo()

Returns accessgateway registration info

Declaration
NSAccessGatewayInfo GetAccessGatewayInfo()
Returns
Type Description
NSAccessGatewayInfo
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

GetAccessToken(String,Bool)

Gets an access token based on the current user's session.

Declaration
String GetAccessToken(String appToken, Bool includeCsSession)
Parameters
Type Name Description
String appToken
Bool includeCsSession
Returns
Type Description
String
Examples
NSUserAgent agent;
String appToken;
Bool includeCsSession;
String res = agent.GetAccessToken(appToken, includeCsSession);

GetAllFunctionalRights(Integer)

Gets a list of all functional rights for the given type of role.

Declaration
NSSelectableMDOListItem[] GetAllFunctionalRights(Integer roleType)
Parameters
Type Name Description
Integer roleType

MDO List name = 'FunctionRights', extra='roleType=0'. See RoleType.

Returns
Type Description
NSSelectableMDOListItem[]
Examples
NSUserAgent agent;
Integer roleType;
NSSelectableMDOListItem[] res = agent.GetAllFunctionalRights(roleType);

GetAllRoles(Integer)

Gets a list of all roles for the given type of role.

Declaration
NSSelectableMDOListItem[] GetAllRoles(Integer roleType)
Parameters
Type Name Description
Integer roleType

MDO List name = 'Roles', extra='0' (roleType) See RoleType.

Returns
Type Description
NSSelectableMDOListItem[]
Examples
NSUserAgent agent;
Integer roleType;
NSSelectableMDOListItem[] res = agent.GetAllRoles(roleType);

GetAllUserGroups(Bool)

Gets all user groups

Declaration
NSUserGroup[] GetAllUserGroups(Bool includeDeleted)
Parameters
Type Name Description
Bool includeDeleted
Returns
Type Description
NSUserGroup[]
Examples
NSUserAgent agent;
Bool includeDeleted;
NSUserGroup[] res = agent.GetAllUserGroups(includeDeleted);

GetCredentialsGroups(Integer)

Gets user groups holding users.

Declaration
NSCredentialsGroup[] GetCredentialsGroups(Integer type)
Parameters
Type Name Description
Integer type
Returns
Type Description
NSCredentialsGroup[]

There will always be at least one groups even if the underlying provider does not support groups.

Remarks

This method is only relevant if the CredentialType control is of type link.

Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

GetCredentialTypes()

Gets available credential types that can be used for authentication

Declaration
NSCredentialType[] GetCredentialTypes()
Returns
Type Description
NSCredentialType[]
Examples
NSUserAgent agent;
NSCredentialType[] res = agent.GetCredentialTypes();

GetCredentialTypesForUserType(Integer)

Gets available credential types that can be used for the specified user type.

Declaration
NSCredentialType[] GetCredentialTypesForUserType(Integer userType)
Parameters
Type Name Description
Integer userType
Returns
Type Description
NSCredentialType[]
Examples
NSUserAgent agent;
Integer userType;
NSCredentialType[] res = agent.GetCredentialTypesForUserType(userType);

GetCredentialUsers(String,String)

Gets credential users within a user group

Declaration
NSCredentialsGroupUsers GetCredentialUsers(String groupName, String type)
Parameters
Type Name Description
String groupName

Name of user group needed to discover the users.

String type

Type of credentials, corresponding to name of plugin and type in the credentials table.

Returns
Type Description
NSCredentialsGroupUsers
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

GetCredentialUsersInGroup(String,String)

Gets credential users within a user group

Declaration
NSCredentialsGroupUsers GetCredentialUsersInGroup(String type, String groupName)
Parameters
Type Name Description
String type
String groupName
Returns
Type Description
NSCredentialsGroupUsers
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

GetDataRight(Integer,String,Integer)

Reads one specific data right at the given position.

Declaration
String GetDataRight(Integer roleId, String tableName, Integer relationToOwner)
Parameters
Type Name Description
Integer roleId
String tableName
Integer relationToOwner

See RoleRelationToOwner.

Returns
Type Description
String
Remarks

An exception will be thrown if non existing position is specified.

Examples
NSUserAgent agent;
Integer roleId;
String tableName;
Integer relationToOwner;
String res = agent.GetDataRight(roleId, tableName, relationToOwner);

GetDataRights(Integer,String)

Reads specific a set of data rights at the given row in the rights matrix.

Declaration
Map GetDataRights(Integer roleId, String tableName)
Parameters
Type Name Description
Integer roleId
String tableName
Returns
Type Description
Map
Remarks

An exception will be thrown if non existing position is specified.

Examples
NSUserAgent agent;
Integer roleId;
String tableName;
Map res = agent.GetDataRights(roleId, tableName);

GetDefaultAssociateUserName(NSUser)

Gets the default username for a person

Declaration
String GetDefaultAssociateUserName(NSUser user)
Parameters
Type Name Description
NSUser user
Returns
Type Description
String
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

GetExternalTokens(String)

Retrieves the tokens from the DB based on the given key

Declaration
NSTokenManagementInfo GetExternalTokens(String key)
Parameters
Type Name Description
String key
Returns
Type Description
NSTokenManagementInfo
Examples
NSUserAgent agent;
String key;
NSTokenManagementInfo res = agent.GetExternalTokens(key);

GetFunctionalRights(Integer)

Gets all functional rights for the given role. Functional rights not set on the role are not included.

Declaration
NSSelectableMDOListItem[] GetFunctionalRights(Integer roleId)
Parameters
Type Name Description
Integer roleId
Returns
Type Description
NSSelectableMDOListItem[]

MDO List name = 'FunctionRights', extra='role=123'

Examples
NSUserAgent agent;
Integer roleId;
NSSelectableMDOListItem[] res = agent.GetFunctionalRights(roleId);

GetRole(Integer)

Gets an NSRole object.

Declaration
NSRole GetRole(Integer roleId)
Parameters
Type Name Description
Integer roleId
Returns
Type Description
NSRole
Examples
NSUserAgent agent;
NSRole thing = agent.GetRole(123);

GetRoleEntity(Integer)

Gets an NSRoleEntity object.

Declaration
NSRoleEntity GetRoleEntity(Integer roleEntityId)
Parameters
Type Name Description
Integer roleEntityId
Returns
Type Description
NSRoleEntity
Examples
NSUserAgent agent;
NSRoleEntity thing = agent.GetRoleEntity(123);

GetServiceAuth(Integer)

Gets an NSServiceAuth object.

Declaration
NSServiceAuth GetServiceAuth(Integer serviceAuthId)
Parameters
Type Name Description
Integer serviceAuthId
Returns
Type Description
NSServiceAuth
Examples
NSUserAgent agent;
NSServiceAuth thing = agent.GetServiceAuth(123);

GetUntrustedCredentials(String)

Gets a set of credentials of a specified type for authenticated user.

Declaration
NSUntrustedCredentials[] GetUntrustedCredentials(String type)
Parameters
Type Name Description
String type
Returns
Type Description
NSUntrustedCredentials[]
Examples
NSUserAgent agent;
String type;
NSUntrustedCredentials[] res = agent.GetUntrustedCredentials(type);

GetUntrustedCredentialsForAssociate(Integer,String)

Gets a set of credentials of a specified type for a specified user. SecretValue is only populated for authenticated user, and system users.

Declaration
NSUntrustedCredentials[] GetUntrustedCredentialsForAssociate(Integer associateId, String type)
Parameters
Type Name Description
Integer associateId
String type
Returns
Type Description
NSUntrustedCredentials[]
Examples
NSUserAgent agent;
Integer associateId;
String type;
NSUntrustedCredentials[] res = agent.GetUntrustedCredentialsForAssociate(associateId, type);

GetUser(Integer)

Gets an NSUser object.

Declaration
NSUser GetUser(Integer userId)
Parameters
Type Name Description
Integer userId
Returns
Type Description
NSUser
Examples
NSUserAgent agent;
NSUser thing = agent.GetUser(123);

GetUserFromEjUserId(Integer)

Gets user from ejUserId.

Declaration
NSUser[] GetUserFromEjUserId(Integer ejUserId)
Parameters
Type Name Description
Integer ejUserId
Returns
Type Description
NSUser[]
Remarks

Used for eJournal Legacy Support.

Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

GetUserFromName(String)

Gets a user, with lookup based on user name.

Declaration
NSUser GetUserFromName(String userName)
Parameters
Type Name Description
String userName
Returns
Type Description
NSUser
Examples
NSUserAgent agent;
String userName;
NSUser res = agent.GetUserFromName(userName);

GetUserFromPersonId(Integer)

Returns the user associated with the supplied person ID.

Declaration
NSUser[] GetUserFromPersonId(Integer personId)
Parameters
Type Name Description
Integer personId
Returns
Type Description
NSUser[]
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

GetUserGroup(Integer)

Gets an NSUserGroup object.

Declaration
NSUserGroup GetUserGroup(Integer userGroupId)
Parameters
Type Name Description
Integer userGroupId
Returns
Type Description
NSUserGroup
Examples
NSUserAgent agent;
NSUserGroup thing = agent.GetUserGroup(123);

GetUserGroupList(Integer[])

Gets an array of UserGroup objects.

Declaration
NSUserGroup[] GetUserGroupList(Integer[]  userGroupIds)
Parameters
Type Name Description
Integer[] userGroupIds
Returns
Type Description
NSUserGroup[]
Examples
Integer[] ids;
NSUserAgent agent;
agent.GetUserGroupList(ids);

GetUserInfo(Integer)

Gets an NSUserInfo object.

Declaration
NSUserInfo GetUserInfo(Integer userInfoId)
Parameters
Type Name Description
Integer userInfoId
Returns
Type Description
NSUserInfo
Examples
NSUserAgent agent;
NSUserInfo thing = agent.GetUserInfo(123);

GetUserInfoList(Integer[])

Gets an array of NSUserInfo objects.

Declaration
NSUserInfo[] GetUserInfoList(Integer[] userInfoIds)
Parameters
Type Name Description
Integer[] userInfoIds
Returns
Type Description
NSUserInfo[]
Examples
Integer[] ids;
NSUserAgent agent;
agent.GetUserInfoList(ids);

GetValidUserName(Integer,Integer,Integer,String)

User administration.

Declaration
String GetValidUserName(Integer associateId, Integer type, Integer personId, String userName)
Parameters
Type Name Description
Integer associateId
Integer type

See AssociateType

Integer personId
String userName
Returns
Type Description
String
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

GetValidUserNameForNewUser(NSUser)

Generates a valid username for an unsaved user.

Declaration
String GetValidUserNameForNewUser(NSUser user)
Parameters
Type Name Description
NSUser user
Returns
Type Description
String
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

IsNickNameUnique(Integer,String)

User administration.

Declaration
Bool IsNickNameUnique(Integer associateId, String nickName)
Parameters
Type Name Description
Integer associateId
String nickName
Returns
Type Description
Bool
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

IsPasswordValid(Integer,Integer,Integer,String)

User administration.

Declaration
Bool IsPasswordValid(Integer associateId, Integer type, Integer personId, String password)
Parameters
Type Name Description
Integer associateId
Integer type

See AssociateType

Integer personId
String password
Returns
Type Description
Bool
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

IsPasswordValidWithReason(Integer,Integer,Integer,String)

User administration.

Declaration
NSUserValidationResult IsPasswordValidWithReason(Integer associateId, Integer type, Integer personId, String password)
Parameters
Type Name Description
Integer associateId
Integer type

See AssociateType

Integer personId
String password
Returns
Type Description
NSUserValidationResult
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

IsUserNameValid(Integer,Integer,Integer,String,String)

User administration.

Declaration
Bool IsUserNameValid(Integer associateId, Integer type, Integer personId, String userName)
Parameters
Type Name Description
Integer associateId
Integer type

See AssociateType

Integer personId
String userName
String username
Returns
Type Description
Bool
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

IsUserNameValidWithReason(Integer,Integer,Integer,String,String)

User administration.

Declaration
NSUserValidationResult IsUserNameValidWithReason(Integer associateId, Integer type, Integer personId, String userName)
Parameters
Type Name Description
Integer associateId
Integer type

See AssociateType

Integer personId
String userName
String username
Returns
Type Description
NSUserValidationResult
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

MakeRetired(Integer,Bool)

Retiring a user means to remove all licenses, setting person.retired=1 and associate.deleted=1. Un-retiring a user means setting person.retired=0 and associate.deleted=0

Declaration
Void MakeRetired(Integer associateId, Bool retired)
Parameters
Type Name Description
Integer associateId
Bool retired
Returns
Type Description
Void
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

RegisterWithAccessGateway(String)

Registers with access gateway if not already done, otherwise will attempt to update.

Declaration
NSAccessGatewayInfo RegisterWithAccessGateway(String redirectUri)
Parameters
Type Name Description
String redirectUri

The registered redirect_uri for AccessGateway OIDC.

Returns
Type Description
NSAccessGatewayInfo
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

RemoveLicenses(Integer)

Removes all user licenses.

Declaration
Void RemoveLicenses(Integer associateId)
Parameters
Type Name Description
Integer associateId
Returns
Type Description
Void
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

RemoveOwnerContact(Integer)

Removes a contact from the ownercontactlink table

Declaration
Void RemoveOwnerContact(Integer contactId)
Parameters
Type Name Description
Integer contactId
Returns
Type Description
Void
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

RemoveUntrustedCredentials(String,String)

Removes a credentials entry for authenticated user.

Declaration
Void RemoveUntrustedCredentials(String type, String publicValue)
Parameters
Type Name Description
String type
String publicValue
Returns
Type Description
Void
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

RemoveUntrustedCredentialsForAssociate(Integer,String,String)

Removes a credentials entry for a specified user.

Declaration
Void RemoveUntrustedCredentialsForAssociate(Integer associateId, String type, String publicValue)
Parameters
Type Name Description
Integer associateId
String type
String publicValue
Returns
Type Description
Void
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

ResolveUserFromInfo(Integer,String,String[],String[],Integer)

Gets a user from the provided information. If the user or associated person does not exist, it will be created on demand.

Declaration
NSResolvedUser ResolveUserFromInfo(Integer contactId, String personName, String[] phoneNumbers, String[] emails, Integer userType, NSCredential credential)
Parameters
Type Name Description
Integer contactId
String personName
String[] phoneNumbers
String[] emails
Integer userType

See AssociateType.

Returns
Type Description
NSResolvedUser
Examples
NSUserAgent agent;
Integer contactId;
String personName;
String[] phoneNumbers;
String[] emails;
Integer userType;
NSCredential credential;
NSResolvedUser res = agent.ResolveUserFromInfo(contactId, personName, phoneNumbers, emails, userType, credential);

SaveCredential(Integer,NSCredential)

Saves (adds/replaces) current credential of the same type for the user.

Declaration
Bool SaveCredential(Integer userId, NSCredential credential)
Parameters
Type Name Description
Integer userId
credential
Returns
Type Description
Bool
Examples
NSUserAgent agent;
Integer userId;
NSCredential credential;
Bool res = agent.SaveCredential(userId, credential);

SaveExternalTokens(NSTokenManagementInfo)

Saves the external tokens to the DB and returns a key that can be used to retrieve them

Declaration
String SaveExternalTokens(NSTokenManagementInfo tokenManagementInfo)
Parameters
Type Name Description
NSTokenManagementInfo tokenManagementInfo
Returns
Type Description
String
Examples
NSUserAgent agent;
NSTokenManagementInfo tokenManagementInfo;
String res = agent.SaveExternalTokens(tokenManagementInfo);

SaveRoleEntity(NSRoleEntity)

Updates the existing NSRoleEntity or creates a new NSRoleEntity if the id parameter is 0

Declaration
NSRoleEntity SaveRoleEntity(NSRoleEntity roleEntity)
Parameters
Type Name Description
NSRoleEntity roleEntity

The NSRoleEntity to save.

Returns
Type Description
NSRoleEntity
Examples
NSUser  agent;
NSRoleEntity thing = agent.CreateDefaultRoleEntity();
thing = agent.SaveRoleEntity(thing);

SaveServiceAuth(NSServiceAuth)

Updates the existing NSServiceAuth or creates a new NSServiceAuth if the id parameter is 0

Declaration
NSServiceAuth SaveServiceAuth(NSServiceAuth serviceAuth)
Parameters
Type Name Description
NSServiceAuth serviceAuth
Returns
Type Description
NSServiceAuth
Examples
NSUser  agent;
NSServiceAuth thing = agent.CreateDefaultServiceAuth();
thing = agent.SaveServiceAuth(thing);

SaveUntrustedCredentials(String,NSUntrustedCredentials)

Saves credentials for authenticated user.

Declaration
Void SaveUntrustedCredentials(String type, NSUntrustedCredentials credentials)
Parameters
Type Name Description
String type
NSUntrustedCredentials credentials
Returns
Type Description
Void
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

SaveUntrustedCredentialsForAssociate(Integer,String,NSUntrustedCredential)

Saves credentials for a specified user.

Declaration
Void SaveUntrustedCredentialsForAssociate(Integer associateId, String type, NSUntrustedCredentials credentials)
Parameters
Type Name Description
Integer associateId
String type
NSUntrustedCredentials credentials
Returns
Type Description
Void
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

SaveUser(NSUser)

Updates the existing NSUser or creates a new NSUser if the id parameter is 0

Declaration
NSUser SaveUser(NSUser user)
Parameters
Type Name Description
NSUser user

The NSUser to save.

Returns
Type Description
NSUser
Examples
NSUser  agent;
NSUser thing = agent.CreateDefaultUser();
thing = agent.SaveUser(thing);

SaveUserFromName(String,NSUser)

Saves a user, with lookup based on the user name.

Declaration
NSUser SaveUserFromName(String userName, NSUser user)
Parameters
Type Name Description
String userName
NSUser user
Returns
Type Description
NSUser
Examples
NSUserAgent agent;
String userName;
NSUser user;
NSUser res = agent.SaveUserFromName(userName, user);

SaveUserGroup(NSUserGroup)

Saves a user group. Sets UserGroup.Deleted to mark a user group as deleted and invisible in the user interface.

Declaration
NSUserGroup SaveUserGroup(NSUserGroup userGroup)
Parameters
Type Name Description
NSUserGroup userGroup
Returns
Type Description
NSUserGroup
Examples
NSUserAgent agent;
NSUserGroup userGroup;
NSUserGroup res = agent.SaveUserGroup(userGroup);

SetDataRight(Integer,String,Integer,String)

Sets one specific data right at the given position.

Declaration
Void SetDataRight(Integer roleId, String tableName, Integer relationToOwner, String dataRightValue)
Parameters
Type Name Description
Integer roleId
String tableName
Integer relationToOwner

See RoleRelationToOwner.

String dataRightValue
Returns
Type Description
Void
Remarks

An exception will be thrown if non existing position is specified.

Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

SetExternalUserInfo(Integer,String,String,Bool,Integer,Integer)

Modifies an external user. Changes external users information according to the flags set in externalUserInfoModification.

Declaration
Void SetExternalUserInfo(Integer associateId, String userName, String password, Bool isActive, Integer roleId, Integer externalUserInfoModification)
Parameters
Type Name Description
Integer associateId
String userName
String password
Bool isActive
Integer roleId
Integer externalUserInfoModification

See ExternalUserInfoModification.

Returns
Type Description
Void
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

SetFunctionalRights(Integer,Integer[])

Sets all functional rights for the given role. Functional rights not specified here will be removed from the role.

Declaration
Void SetFunctionalRights(Integer roleId, Integer[] functionalRightIds)
Parameters
Type Name Description
Integer roleId
Integer[] functionalRightIds
Returns
Type Description
Void
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

SetGeneratedPassword(Integer)

User administration.

Declaration
String SetGeneratedPassword(Integer associateId)
Parameters
Type Name Description
Integer associateId
Returns
Type Description
String
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

SetGeneratedPasswordFromName(String)

User administration.

Declaration
String SetGeneratedPasswordFromName(String associateName)
Parameters
Type Name Description
String associateName
Returns
Type Description
String
Examples
NSUserAgent agent;
agent.callMethod(arg1, arg2);

SetPassword(Integer,String)

Changes password for a user.

Declaration
Bool SetPassword(Integer associateId, String password)
Parameters
Type Name Description
Integer associateId
String password
Returns
Type Description
Bool
Examples
NSUserAgent agent;
Integer associateId;
String password;
Bool res = agent.SetPassword(associateId, password);

SetPasswordFromName(String,String)

Changes password for a user.

Declaration
Bool SetPasswordFromName(String associateName, String password)
Parameters
Type Name Description
String associateName
String password
Returns
Type Description
Bool
Examples
NSUserAgent agent;
String associateName;
String password;
Bool res = agent.SetPasswordFromName(associateName, password);

ValidateUser(NSUser)

Checks that entity is ready for saving, return error messages by field.

Declaration
Map ValidateUser(NSUser user)
Parameters
Type Name Description
NSUser user
Returns
Type Description
Map
Examples
NSUserAgent agent;
NSUser user;
Map res = agent.ValidateUser(user);
In This Article
  • Constructors
    • NSUserAgent()
  • Methods
    • AddOwnerContact(Integer)
    • CanChangePassword(Integer)
    • ChangeOwnPassword(String,String)
    • ChangePassword(Integer,String,String)
    • ChangePasswordFromName(String,String,String)
    • ChangeUserType(NSUser,Integer)
    • CheckAccessGatewayRegistration()
    • CreateDefaultRoleEntity()
    • CreateDefaultRoleEntityFromType(Integer)
    • CreateDefaultServiceAuth()
    • CreateDefaultUntrustedCredentials()
    • CreateDefaultUser()
    • CreateDefaultUserFromUserType(Integer)
    • CreateDefaultUserFromUserTypeAndCredential(Integer,Integer,String,String,String)
    • CreateDefaultUserFromUserTypeAndPersonId(Integer,Integer)
    • CreateExternalUser(Integer,String,String,Integer,Bool)
    • CreateUserGroup()
    • DecryptAndSaveExternalTokens(NSTokenManagementInfo)
    • DeleteCredential(Integer,String)
    • DeleteExternalUser(Integer)
    • DeleteRole(Integer,Integer)
    • DeleteServiceAuth(Integer)
    • DeleteUser(Integer)
    • DeleteUserFromName(String)
    • DeleteUserGroup(Integer,Integer)
    • FindCredentialsGroups(String,String)
    • FindCredentialUsers(String,String)
    • FindRolesWithFunctionalRight(String)
    • FindRolesWithFunctionalRights(String[])
    • FindRolesWithoutFunctionalRights(String[])
    • GenerateNewPasswordForExternalUser(String)
    • GetAccessGatewayInfo()
    • GetAccessToken(String,Bool)
    • GetAllFunctionalRights(Integer)
    • GetAllRoles(Integer)
    • GetAllUserGroups(Bool)
    • GetCredentialsGroups(Integer)
    • GetCredentialTypes()
    • GetCredentialTypesForUserType(Integer)
    • GetCredentialUsers(String,String)
    • GetCredentialUsersInGroup(String,String)
    • GetDataRight(Integer,String,Integer)
    • GetDataRights(Integer,String)
    • GetDefaultAssociateUserName(NSUser)
    • GetExternalTokens(String)
    • GetFunctionalRights(Integer)
    • GetRole(Integer)
    • GetRoleEntity(Integer)
    • GetServiceAuth(Integer)
    • GetUntrustedCredentials(String)
    • GetUntrustedCredentialsForAssociate(Integer,String)
    • GetUser(Integer)
    • GetUserFromEjUserId(Integer)
    • GetUserFromName(String)
    • GetUserFromPersonId(Integer)
    • GetUserGroup(Integer)
    • GetUserGroupList(Integer[])
    • GetUserInfo(Integer)
    • GetUserInfoList(Integer[])
    • GetValidUserName(Integer,Integer,Integer,String)
    • GetValidUserNameForNewUser(NSUser)
    • IsNickNameUnique(Integer,String)
    • IsPasswordValid(Integer,Integer,Integer,String)
    • IsPasswordValidWithReason(Integer,Integer,Integer,String)
    • IsUserNameValid(Integer,Integer,Integer,String,String)
    • IsUserNameValidWithReason(Integer,Integer,Integer,String,String)
    • MakeRetired(Integer,Bool)
    • RegisterWithAccessGateway(String)
    • RemoveLicenses(Integer)
    • RemoveOwnerContact(Integer)
    • RemoveUntrustedCredentials(String,String)
    • RemoveUntrustedCredentialsForAssociate(Integer,String,String)
    • ResolveUserFromInfo(Integer,String,String[],String[],Integer)
    • SaveCredential(Integer,NSCredential)
    • SaveExternalTokens(NSTokenManagementInfo)
    • SaveRoleEntity(NSRoleEntity)
    • SaveServiceAuth(NSServiceAuth)
    • SaveUntrustedCredentials(String,NSUntrustedCredentials)
    • SaveUntrustedCredentialsForAssociate(Integer,String,NSUntrustedCredential)
    • SaveUser(NSUser)
    • SaveUserFromName(String,NSUser)
    • SaveUserGroup(NSUserGroup)
    • SetDataRight(Integer,String,Integer,String)
    • SetExternalUserInfo(Integer,String,String,Bool,Integer,Integer)
    • SetFunctionalRights(Integer,Integer[])
    • SetGeneratedPassword(Integer)
    • SetGeneratedPasswordFromName(String)
    • SetPassword(Integer,String)
    • SetPasswordFromName(String,String)
    • ValidateUser(NSUser)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top