addUser

[ Function ]

public static addUser(
    userName: string,
    password: string | null,
    callback: null | ((this: void, data: TcHmi.IResultObject) => void) = null
): TcHmi.IErrorDetails;

Creates a new user.

Each new user is by default at least a member of the "__SystemUsers" group and uses the language of the project. If no domain is specified, the extension TcHmiUserManagement is used for user management.

This behavior can be changed on the server configuration page under TcHmiSrv under the name "Default Usergroup" and "Default authentication extension".

Parameter

Name

Type

Description

userName

string

Name of the new user

password

string, null

Plain text password of the new user. Null can be specified if the extension does not require a password for the user.

callback [ optional ]

(data: TcHmi.IResultObject) => void, null

Asynchronous callback function that is triggered once the action is completed.

Return value

Type

Description

TcHmi.ErrorDetails

Returns confirmation as to whether the operation was successfully sent.

addUser 1:

Available from version 1.10.1018.48

Sample - JavaScript

TcHmi.Server.UserManagement.addUser('newUser', 'Gbt3fC79ZmMEFUFJ', function(data) {
    if (data.error === TcHmi.Errors.NONE) {
        // Success
    } else {
        // Error
    }
});