forceLogoutEx
[ Function ]
public static forceLogoutEx(
username: string | TcHmi.Server.IForceLogoutTarget | null | undefined,
requestOptions: Server.IRequestOptions,
callback?: null | (
(data: TcHmi.IResultObject) => void
) = null
): boolean;
Logs out any user if the appropriate user privileges are available.
Parameter
Name | Type | Description |
---|---|---|
username | The name of the user to be logged out. If an empty string or null is passed, all users of the server are logged out. From version 1.10.1172.0: Alternatively, an object can be passed that specifies conditions for a user to log out. | |
requestOptions | Options | |
callback [ optional ] | null | (data: TcHmi.IResultObject) => void | Asynchronous callback function that is triggered when the operation was terminated. |
Return value
Type | Description |
---|---|
Returns confirmation as to whether the operation was successfully sent. |
Available from version 1.10 |
Up to version 1.10.1172.0 only string and null were allowed as userName. |
Sample - JavaScript
// Logout a user
TcHmi.Server.forceLogoutEx('johnDoe',{ timeout: 2000 }, function(data) {
if (data.error === TcHmi.Errors.NONE) {
// Success
} else {
// Error
}
});
From version 1.10.1172.0
// Logout johnDoe from the authenfication domain TcHmiUserManagement
TcHmi.Server.forceLogoutEx(
'TcHmiUserManagement::johnDoe',
{ timeout: 2000 },
function(data) {
if (data.error === TcHmi.Errors.NONE) {
// Success
} else {
// Error
}
}
);
// Logout all users from this authenfication domain
TcHmi.Server.forceLogoutEx(
'TcHmiUserManagement::',
{ timeout: 2000 },
function(data) {
if (data.error === TcHmi.Errors.NONE) {
// Success
} else {
// Error
}
}
);
// Logout all users which matches ONE of the conditions:
// IP: 127.0.0.1 (as seen from the server)
// clientCertificate with this fingerprint/thumbprint
// member of the group 'SystemAdministrator'
TcHmi.Server.forceLogoutEx(
{
endpoint: '127.0.0.1',
clientCertificate: '8e810e91d365662783480d0e4f54f9e037bc1157c9f5634a36bbcc096530dd960f66e5a072d069b5c8dce66bb633166131b8ad49467d27a93cd72cd96f346a80',
group: 'SystemAdministrator'
},
{ timeout: 2000 },
function(data) {
if (data.error === TcHmi.Errors.NONE) {
// Success
} else {
// Error
}
}
);