addUserEx
[ Function ]
public static addUserEx(
userName: string,
password: string,
options: Partial<TcHmi.Server.UserManagement.IUserDetails> | null = null,
requestOptions: TcHmi.Server.IRequestOptions | null = 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 | Name of the new user | |
password | Plain text password of the new user. | |
options | Details of the new user. If a property is not set, the default applies. | |
requestOptions | Server request options | |
callback [ optional ] | (data: TcHmi.IResultObject) => void, null | Asynchronous callback function that is triggered once the action has been completed. |
Return value
Type | Description |
---|---|
Returns confirmation as to whether the operation was successfully sent. |
Available from version 1.10.1018.48 |
Sample – JavaScript
TcHmi.Server.UserManagement.addUserEx(
'newUser',
'Gbt3fC79ZmMEFUFJ',
{groups: ['__SystemAdministrators'], enabled: true, locale: 'de'},
{timeout: 2000},
function(data) {
if (data.error === TcHmi.Errors.NONE) {
// Success
} else {
// Error
}
}
);