//-----------------------------------------------------------------------------
// IUserInfoExample.js file
//-----------------------------------------------------------------------------
// There is described the usage of the IUserInfo object in the example.
//-----------------------------------------------------------------------------
//@ Start Example
// Message displaying function
function ShowMessage(Str) {
for (var i = 1; i < arguments.length; i++ ) {
Str = Str.replace(new RegExp('%' + i), arguments[i]);
}
WScript.Echo(Str);
}
// Function of the user's derived data formation
function GetUserInfo(UserInfo, Value) {
// A variable for the data strings formation
var TotalString = new String();
// Result value initial cleaning
Value.Value.Clear();
// Sequential adding of the user's data to the storage
TotalString = "Contact identifier: " + UserInfo.ContactID;
Value.Value.Add(TotalString);
TotalString = "Contact name: " + UserInfo.ContactName;
Value.Value.Add(TotalString);
TotalString = "User identifier: " + UserInfo.ID;
Value.Value.Add(TotalString);
TotalString = "Is the user an administrator? " + UserInfo.IsAdmin;
Value.Value.Add(TotalString);
TotalString = "User name: " + UserInfo.Name;
Value.Value.Add(TotalString);
}
// Creating the database connection and data storage objects
var Connector = new ActiveXObject('TSDskObjectLibrary.DskConnector');
var UserInfo = new ActiveXObject('TSObjectLibrary.UserInfo');
var Value = new ActiveXObject('TSObjectLibrary.Value');
Value.Value = new ActiveXObject('TSObjectLibrary.StringsList');
if (Connector.Login("Example of the IUserInfo use")) {
// Recieving the user information
UserInfo = Connector.CurrentUser;
// Formation and displaying the user information
GetUserInfo(UserInfo, Value)
ShowMessage(Value.Value.Text);
// Displaying the information about the collection of access management units
Value.Value = UserInfo.AdminUnitIDsList;
ShowMessage(Value.Value.Text);
// Setting the attribute values
UserInfo.Attributes.Values("TestAttribute") = "Attribute value";
// Displaying the attribute value that has been set
ShowMessage(UserInfo.Attributes.Values("TestAttribute"));
}
//@ End Example
|
Copyright (с) Terrasoft 2002-2007.
|