Class NSUserAgent

User administration.

Examples

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

Constructors

NSUserAgent()

User administration.

Declaration

NSUserAgent

Methods

AddOwnerContact(Integer)

Declaration

Void AddOwnerContact(Integer contactId)

Parameters

Type Name Description
Integer contactId

Returns

Type Description
Void

CanChangePassword(Integer)

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

Declaration

Bool CanChangePassword(Integer associateId)

Examples

NSUserAgent agent;
Integer associateId;
Bool res = agent.CanChangePassword(associateId);

Parameters

Type Name Description
Integer associateId

Returns

Type Description
Bool

ChangeOwnPassword(String,String)

Changes password for a user.

Declaration

Bool ChangeOwnPassword(String oldPassword, String newPassword)

Examples

NSUserAgent agent;
String oldPassword;
String newPassword;
Bool res = agent.ChangeOwnPassword(oldPassword, newPassword);

Parameters

Type Name Description
String oldPassword
String newPassword

Returns

Type Description
Bool

ChangePassword(Integer,String,String)

Changes password for a user.

Declaration

Bool ChangePassword(Integer associateId, String oldPassword, String newPassword)

Examples

NSUserAgent agent;
Integer associateId;
String oldPassword;
String newPassword;
Bool res = agent.ChangePassword(associateId, oldPassword, newPassword);

Parameters

Type Name Description
Integer associateId
String oldPassword
String newPassword

Returns

Type Description
Bool

ChangePasswordFromName(String,String,String)

Changes password for a user.

Declaration

Bool ChangePasswordFromName(String associateName, String oldPassword, String newPassword)

Examples

NSUserAgent agent;
String associateName;
String oldPassword;
String newPassword;
Bool res = agent.ChangePasswordFromName(associateName, oldPassword, newPassword);

Parameters

Type Name Description
String associateName
String oldPassword
String newPassword

Returns

Type Description
Bool

ChangeUserType(NSUser,Integer)

Gets a user from the user name.

Declaration

NSUser ChangeUserType(NSUser user, Integer userType)

Examples

NSUserAgent agent;
NSUser user;
Integer userType;
NSUser res = agent.ChangeUserType(user, userType);

Parameters

Type Name Description
NSUser user
Integer userType

Returns

Type Description
NSUser

CheckAccessGatewayRegistration()

Checks if AccessGatewayRegistration is valid

Declaration

Bool CheckAccessGatewayRegistration()

Examples

NSUserAgent agent;
Bool res = agent.CheckAccessGatewayRegistration();

Returns

Type Description
Bool

CreateDefaultRoleEntity()

Sets default values into a new NSRoleEntity.

Declaration

NSRoleEntity CreateDefaultRoleEntity()

Examples

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

Returns

Type Description
NSRoleEntity

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)

Examples

NSUserAgent agent;
Integer type;
NSRoleEntity res = agent.CreateDefaultRoleEntityFromType(type);

Parameters

Type Name Description
Integer type See <xref href="CRMScript.NetServer.RoleType" data-throw-if-not-resolved="false"></xref>.

Returns

Type Description
NSRoleEntity

CreateDefaultServiceAuth()

Sets default values into a new NSServiceAuth.

Declaration

NSServiceAuth CreateDefaultServiceAuth()

Examples

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

Returns

Type Description
NSServiceAuth

CreateDefaultUntrustedCredentials()

Sets default values into a new NSUntrustedCredentials.

Declaration

NSUntrustedCredentials CreateDefaultUntrustedCredentials()

Examples

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

Returns

Type Description
NSUntrustedCredentials

CreateDefaultUser()

Sets default values into a new NSUser.

Declaration

NSUser CreateDefaultUser()

Examples

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

Returns

Type Description
NSUser

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)

Examples

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

Parameters

Type Name Description
Integer userType See <xref href="CRMScript.NetServer.AssociateType" data-throw-if-not-resolved="false"></xref>.

Returns

Type Description
NSUser

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 <xref href="CRMScript.NetServer.AssociateType" data-throw-if-not-resolved="false"></xref>
Integer contactId
String credentialType
String credentialValue
String credentialDisplayValue

Returns

Type Description
NSUser

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)

Examples

NSUserAgent agent;
Integer userType;
Integer personId;
NSUser res = agent.CreateDefaultUserFromUserTypeAndPersonId(userType, personId);

Parameters

Type Name Description
Integer userType See <xref href="CRMScript.NetServer.AssociateType" data-throw-if-not-resolved="false"></xref>
Integer personId

Returns

Type Description
NSUser

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)

Examples

NSUserAgent agent;
Integer personId;
String userName;
String password;
Integer roleId;
Bool isActive;
Integer res = agent.CreateExternalUser(personId, userName, password, roleId, isActive);

Parameters

Type Name Description
Integer personId
String userName
String password
Integer roleId
Bool isActive

Returns

Type Description
Integer

CreateUserGroup()

Creates UserGroup (Rank is assigned to the highest rank)

Declaration

NSUserGroup CreateUserGroup()

Returns

Type Description
NSUserGroup

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)

Examples

NSUserAgent agent;
NSTokenManagementInfo tokenManagementInfo;
String res = agent.DecryptAndSaveExternalTokens(tokenManagementInfo);

Parameters

Type Name Description
NSTokenManagementInfo tokenManagementInfo

Returns

Type Description
String

DeleteCredential(Integer,String)

Removes credential of a specific type for a user

Declaration

Bool DeleteCredential(Integer userId, String credentialType)

Examples

NSUserAgent agent;
Integer userId;
String credentialType;
Bool res = agent.DeleteCredential(userId, credentialType);

Parameters

Type Name Description
Integer userId
String credentialType

Returns

Type Description
Bool

DeleteExternalUser(Integer)

Deletes an associate of type external user.

Declaration

Void DeleteExternalUser(Integer associateId)

Parameters

Type Name Description
Integer associateId

Returns

Type Description
Void

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

DeleteServiceAuth(Integer)

Deletes the NSServiceAuth

Declaration

DeleteServiceAuth(Integer serviceAuth)

Examples

NSUserAgent agent;
agent.DeleteServiceAuth(123);

Parameters

Type Name Description
Integer serviceAuth

Returns

Type Description
Void

DeleteUser(Integer)

Deletes the NSUser

Declaration

DeleteUser(Integer user)

Examples

NSUserAgent agent;
agent.DeleteUser(123);

Parameters

Type Name Description
Integer user

Returns

Type Description
Void

DeleteUserFromName(String)

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

Declaration

Void DeleteUserFromName(String userName)

Examples

NSUserAgent agent;
String userName;
agent.DeleteUserFromName(userName);

Parameters

Type Name Description
String userName

Returns

Type Description
Void

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

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.

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

FindRolesWithFunctionalRight(String)

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

Declaration

NSMDOListItem[] FindRolesWithFunctionalRight(String functionalRightName)

Examples

NSUserAgent agent;
String functionalRightName;
NSMDOListItem[] res = agent.FindRolesWithFunctionalRight(functionalRightName);

Parameters

Type Name Description
String functionalRightName

Returns

Type Description
NSMDOListItem[]

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)

Examples

NSUserAgent agent;
String[] functionalRightNames;
Integer[] res = agent.FindRolesWithFunctionalRights(functionalRightNames);

Parameters

Type Name Description
String[] functionalRightNames

Returns

Type Description
Integer[]

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)

Examples

NSUserAgent agent;
String[] functionalRightNames;
Integer[] res = agent.FindRolesWithoutFunctionalRights(functionalRightNames);

Parameters

Type Name Description
String[] functionalRightNames

Returns

Type Description
Integer[]

GenerateNewPasswordForExternalUser(String)

Generates a new password for an external user.

Declaration

String GenerateNewPasswordForExternalUser(String associateName)

Examples

NSUserAgent agent;
String associateName;
String res = agent.GenerateNewPasswordForExternalUser(associateName);

Parameters

Type Name Description
String associateName

Returns

Type Description
String

GetAccessGatewayInfo()

Returns accessgateway registration info

Declaration

NSAccessGatewayInfo GetAccessGatewayInfo()

Returns

Type Description
NSAccessGatewayInfo

GetAccessToken(String,Bool)

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

Declaration

String GetAccessToken(String appToken, Bool includeCsSession)

Examples

NSUserAgent agent;
String appToken;
Bool includeCsSession;
String res = agent.GetAccessToken(appToken, includeCsSession);

Parameters

Type Name Description
String appToken
Bool includeCsSession

Returns

Type Description
String

GetAllFunctionalRights(Integer)

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

Declaration

NSSelectableMDOListItem[] GetAllFunctionalRights(Integer roleType)

Examples

NSUserAgent agent;
Integer roleType;
NSSelectableMDOListItem[] res = agent.GetAllFunctionalRights(roleType);

Parameters

Type Name Description
Integer roleType MDO List name = 'FunctionRights', extra='roleType=0'. See <xref href="CRMScript.NetServer.RoleType" data-throw-if-not-resolved="false"></xref>.

Returns

Type Description
NSSelectableMDOListItem[]

GetAllRoles(Integer)

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

Declaration

NSSelectableMDOListItem[] GetAllRoles(Integer roleType)

Examples

NSUserAgent agent;
Integer roleType;
NSSelectableMDOListItem[] res = agent.GetAllRoles(roleType);

Parameters

Type Name Description
Integer roleType MDO List name = 'Roles', extra='0' (roleType) See <xref href="CRMScript.NetServer.RoleType" data-throw-if-not-resolved="false"></xref>.

Returns

Type Description
NSSelectableMDOListItem[]

GetAllUserGroups(Bool)

Gets all user groups

Declaration

NSUserGroup[] GetAllUserGroups(Bool includeDeleted)

Examples

NSUserAgent agent;
Bool includeDeleted;
NSUserGroup[] res = agent.GetAllUserGroups(includeDeleted);

Parameters

Type Name Description
Bool includeDeleted

Returns

Type Description
NSUserGroup[]

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.

GetCredentialTypes()

Gets available credential types that can be used for authentication

Declaration

NSCredentialType[] GetCredentialTypes()

Examples

NSUserAgent agent;
NSCredentialType[] res = agent.GetCredentialTypes();

Returns

Type Description
NSCredentialType[]

GetCredentialTypesForUserType(Integer)

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

Declaration

NSCredentialType[] GetCredentialTypesForUserType(Integer userType)

Examples

NSUserAgent agent;
Integer userType;
NSCredentialType[] res = agent.GetCredentialTypesForUserType(userType);

Parameters

Type Name Description
Integer userType

Returns

Type Description
NSCredentialType[]

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

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

GetDataRight(Integer,String,Integer)

Reads one specific data right at the given position.

Declaration

String GetDataRight(Integer roleId, String tableName, Integer relationToOwner)

Examples

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

Parameters

Type Name Description
Integer roleId
String tableName
Integer relationToOwner See <xref href="CRMScript.NetServer.RoleRelationToOwner" data-throw-if-not-resolved="false"></xref>.

Returns

Type Description
String

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)

Examples

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

Parameters

Type Name Description
Integer roleId
String tableName

Returns

Type Description
Map

GetDefaultAssociateUserName(NSUser)

Gets the default username for a person

Declaration

String GetDefaultAssociateUserName(NSUser user)

Parameters

Type Name Description
NSUser user

Returns

Type Description
String

GetExternalTokens(String)

Retrieves the tokens from the DB based on the given key

Declaration

NSTokenManagementInfo GetExternalTokens(String key)

Examples

NSUserAgent agent;
String key;
NSTokenManagementInfo res = agent.GetExternalTokens(key);

Parameters

Type Name Description
String key

Returns

Type Description
NSTokenManagementInfo

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)

Examples

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

Parameters

Type Name Description
Integer roleId

Returns

Type Description
NSSelectableMDOListItem[] MDO List name = 'FunctionRights', extra='role=123'

GetRole(Integer)

Gets an NSRole object.

Declaration

NSRole GetRole(Integer roleId)

Examples

NSUserAgent agent;
NSRole thing = agent.GetRole(123);

Parameters

Type Name Description
Integer roleId

Returns

Type Description
NSRole

GetRoleEntity(Integer)

Gets an NSRoleEntity object.

Declaration

NSRoleEntity GetRoleEntity(Integer roleEntityId)

Examples

NSUserAgent agent;
NSRoleEntity thing = agent.GetRoleEntity(123);

Parameters

Type Name Description
Integer roleEntityId

Returns

Type Description
NSRoleEntity

GetServiceAuth(Integer)

Gets an NSServiceAuth object.

Declaration

NSServiceAuth GetServiceAuth(Integer serviceAuthId)

Examples

NSUserAgent agent;
NSServiceAuth thing = agent.GetServiceAuth(123);

Parameters

Type Name Description
Integer serviceAuthId

Returns

Type Description
NSServiceAuth

GetUntrustedCredentials(String)

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

Declaration

NSUntrustedCredentials[] GetUntrustedCredentials(String type)

Examples

NSUserAgent agent;
String type;
NSUntrustedCredentials[] res = agent.GetUntrustedCredentials(type);

Parameters

Type Name Description
String type

Returns

Type Description
NSUntrustedCredentials[]

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)

Examples

NSUserAgent agent;
Integer associateId;
String type;
NSUntrustedCredentials[] res = agent.GetUntrustedCredentialsForAssociate(associateId, type);

Parameters

Type Name Description
Integer associateId
String type

Returns

Type Description
NSUntrustedCredentials[]

GetUser(Integer)

Gets an NSUser object.

Declaration

NSUser GetUser(Integer userId)

Examples

NSUserAgent agent;
NSUser thing = agent.GetUser(123);

Parameters

Type Name Description
Integer userId

Returns

Type Description
NSUser

GetUserFromEjUserId(Integer)

Gets user from ejUserId.

Declaration

NSUser[] GetUserFromEjUserId(Integer ejUserId)

Parameters

Type Name Description
Integer ejUserId

Returns

Type Description
NSUser[]

GetUserFromName(String)

Gets a user, with lookup based on user name.

Declaration

NSUser GetUserFromName(String userName)

Examples

NSUserAgent agent;
String userName;
NSUser res = agent.GetUserFromName(userName);

Parameters

Type Name Description
String userName

Returns

Type Description
NSUser

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[]

GetUserGroup(Integer)

Gets an NSUserGroup object.

Declaration

NSUserGroup GetUserGroup(Integer userGroupId)

Examples

NSUserAgent agent;
NSUserGroup thing = agent.GetUserGroup(123);

Parameters

Type Name Description
Integer userGroupId

Returns

Type Description
NSUserGroup

GetUserGroupList(Integer[])

Gets an array of UserGroup objects.

Declaration

NSUserGroup[] GetUserGroupList(Integer[]  userGroupIds)

Examples

Integer[] ids;
NSUserAgent agent;
agent.GetUserGroupList(ids);

Parameters

Type Name Description
Integer[] userGroupIds

Returns

Type Description
NSUserGroup[]

GetUserInfo(Integer)

Gets an NSUserInfo object.

Declaration

NSUserInfo GetUserInfo(Integer userInfoId)

Examples

NSUserAgent agent;
NSUserInfo thing = agent.GetUserInfo(123);

Parameters

Type Name Description
Integer userInfoId

Returns

Type Description
NSUserInfo

GetUserInfoList(Integer[])

Gets an array of NSUserInfo objects.

Declaration

NSUserInfo[] GetUserInfoList(Integer[] userInfoIds)

Examples

Integer[] ids;
NSUserAgent agent;
agent.GetUserInfoList(ids);

Parameters

Type Name Description
Integer[] userInfoIds

Returns

Type Description
NSUserInfo[]

GetValidUserName(Integer,Integer,Integer,String)

Declaration

String GetValidUserName(Integer associateId, Integer type, Integer personId, String userName)

Parameters

Type Name Description
Integer associateId
Integer type See <xref href="CRMScript.NetServer.AssociateType" data-throw-if-not-resolved="false"></xref>
Integer personId
String userName

Returns

Type Description
String

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

IsNickNameUnique(Integer,String)

Declaration

Bool IsNickNameUnique(Integer associateId, String nickName)

Parameters

Type Name Description
Integer associateId
String nickName

Returns

Type Description
Bool

IsPasswordValid(Integer,Integer,Integer,String)

Declaration

Bool IsPasswordValid(Integer associateId, Integer type, Integer personId, String password)

Parameters

Type Name Description
Integer associateId
Integer type See <xref href="CRMScript.NetServer.AssociateType" data-throw-if-not-resolved="false"></xref>
Integer personId
String password

Returns

Type Description
Bool

IsPasswordValidWithReason(Integer,Integer,Integer,String)

Declaration

NSUserValidationResult IsPasswordValidWithReason(Integer associateId, Integer type, Integer personId, String password)

Parameters

Type Name Description
Integer associateId
Integer type See <xref href="CRMScript.NetServer.AssociateType" data-throw-if-not-resolved="false"></xref>
Integer personId
String password

Returns

Type Description
NSUserValidationResult

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

Declaration

Bool IsUserNameValid(Integer associateId, Integer type, Integer personId, String userName)

Parameters

Type Name Description
Integer associateId
Integer type See <xref href="CRMScript.NetServer.AssociateType" data-throw-if-not-resolved="false"></xref>
Integer personId
String userName
String username

Returns

Type Description
Bool

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

Declaration

NSUserValidationResult IsUserNameValidWithReason(Integer associateId, Integer type, Integer personId, String userName)

Parameters

Type Name Description
Integer associateId
Integer type See <xref href="CRMScript.NetServer.AssociateType" data-throw-if-not-resolved="false"></xref>
Integer personId
String userName
String username

Returns

Type Description
NSUserValidationResult

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)

Examples

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

Parameters

Type Name Description
Integer associateId
Bool retired

Returns

Type Description
Void

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

RemoveLicenses(Integer)

Removes all user licenses.

Declaration

Void RemoveLicenses(Integer associateId)

Parameters

Type Name Description
Integer associateId

Returns

Type Description
Void

RemoveOwnerContact(Integer)

Removes a contact from the ownercontactlink table

Declaration

Void RemoveOwnerContact(Integer contactId)

Parameters

Type Name Description
Integer contactId

Returns

Type Description
Void

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

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

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)

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

Parameters

Type Name Description
Integer contactId
String personName
String[] phoneNumbers
String[] emails
Integer userType See <xref href="CRMScript.NetServer.AssociateType" data-throw-if-not-resolved="false"></xref>.

Returns

Type Description
NSResolvedUser

SaveCredential(Integer,NSCredential)

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

Declaration

Bool SaveCredential(Integer userId, NSCredential credential)

Examples

NSUserAgent agent;
Integer userId;
NSCredential credential;
Bool res = agent.SaveCredential(userId, credential);

Parameters

Type Name Description
Integer userId
credential

Returns

Type Description
Bool

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)

Examples

NSUserAgent agent;
NSTokenManagementInfo tokenManagementInfo;
String res = agent.SaveExternalTokens(tokenManagementInfo);

Parameters

Type Name Description
NSTokenManagementInfo tokenManagementInfo

Returns

Type Description
String

SaveRoleEntity(NSRoleEntity)

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

Declaration

NSRoleEntity SaveRoleEntity(NSRoleEntity roleEntity)

Examples

NSUser  agent;
NSRoleEntity thing = agent.CreateDefaultRoleEntity();
thing = agent.SaveRoleEntity(thing);

Parameters

Type Name Description
NSRoleEntity roleEntity The NSRoleEntity to save.

Returns

Type Description
NSRoleEntity

SaveServiceAuth(NSServiceAuth)

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

Declaration

NSServiceAuth SaveServiceAuth(NSServiceAuth serviceAuth)

Examples

NSUser  agent;
NSServiceAuth thing = agent.CreateDefaultServiceAuth();
thing = agent.SaveServiceAuth(thing);

Parameters

Type Name Description
NSServiceAuth serviceAuth

Returns

Type Description
NSServiceAuth

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

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

SaveUser(NSUser)

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

Declaration

NSUser SaveUser(NSUser user)

Examples

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

Parameters

Type Name Description
NSUser user The NSUser to save.

Returns

Type Description
NSUser

SaveUserFromName(String,NSUser)

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

Declaration

NSUser SaveUserFromName(String userName, NSUser user)

Examples

NSUserAgent agent;
String userName;
NSUser user;
NSUser res = agent.SaveUserFromName(userName, user);

Parameters

Type Name Description
String userName
NSUser user

Returns

Type Description
NSUser

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)

Examples

NSUserAgent agent;
NSUserGroup userGroup;
NSUserGroup res = agent.SaveUserGroup(userGroup);

Parameters

Type Name Description
NSUserGroup userGroup

Returns

Type Description
NSUserGroup

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 <xref href="CRMScript.NetServer.RoleRelationToOwner" data-throw-if-not-resolved="false"></xref>.
String dataRightValue

Returns

Type Description
Void

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 <xref href="CRMScript.NetServer.ExternalUserInfoModification" data-throw-if-not-resolved="false"></xref>.

Returns

Type Description
Void

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

SetGeneratedPassword(Integer)

Declaration

String SetGeneratedPassword(Integer associateId)

Parameters

Type Name Description
Integer associateId

Returns

Type Description
String

SetGeneratedPasswordFromName(String)

Declaration

String SetGeneratedPasswordFromName(String associateName)

Parameters

Type Name Description
String associateName

Returns

Type Description
String

SetPassword(Integer,String)

Changes password for a user.

Declaration

Bool SetPassword(Integer associateId, String password)

Examples

NSUserAgent agent;
Integer associateId;
String password;
Bool res = agent.SetPassword(associateId, password);

Parameters

Type Name Description
Integer associateId
String password

Returns

Type Description
Bool

SetPasswordFromName(String,String)

Changes password for a user.

Declaration

Bool SetPasswordFromName(String associateName, String password)

Examples

NSUserAgent agent;
String associateName;
String password;
Bool res = agent.SetPasswordFromName(associateName, password);

Parameters

Type Name Description
String associateName
String password

Returns

Type Description
Bool

ValidateUser(NSUser)

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

Declaration

Map ValidateUser(NSUser user)

Examples

NSUserAgent agent;
NSUser user;
Map res = agent.ValidateUser(user);

Parameters

Type Name Description
NSUser user

Returns

Type Description
Map