ICredentials.UserStation

Syntax

UserStation: String;

Description

The UserStation property determines a name of the user workstation to write it into the access protocol.

Comments

The name is set in the form: domain\workstation. If this property is set to non-empty on setting accounts, the specified value will be used to check workstation locking and to write to access protocol, otherwise name of the workstation with the running process is used.

Example

Executing the example requires EditBox1 and EditBox2 of EditBox type on the form. The schema must contain a table with the Table identifier. The user, under whose profile the connection is established, must be added to the repository users list and must have the Login and Right for Reading and Opening All Objects privileges.

Sub UserProc;

Var

MbDef: IMetabaseDefinition;

Package: ISecurityPackage;

PC: IPasswordCredentials;

Mb: IMetabase;

MbManager: IMetabaseManager;

Table : ITable;

Field : ITableField;

Begin

Mb := Null;

MbManager := MetabaseManagerFactory.Active;

MbDef := MbManager.Definitions.FindById("student");

Debug.AssertMsg(MbDef <> Null, "Metabase description is not found");

Package := MbManager.Packs.FindById(MbDef.SecurityPackage).Package;

PC := Package.CreateCredentials(AuthenticationMode.Password) As IPasswordCredentials;

PC.UserName := EditBox1.Text;

PC.Password := EditBox2.Text;

PC.UserStation := "PROGNOZ\Test";

Mb := MbDef.Open(PC,ApplicationMode.Win,LocaleCodeID.Russian);

WinApplication.InformationBox(Connection is established);

Table := Mb.ItemById ("Table").Bind As ITable;

For Each Field In Table.Fields Do

Debug.WriteLine(Field.Name);

End For;

End Sub UserProc;

In case of entering the correct password and user name the connection to the "student" scheme is established, under the condition that the user is allowed to logon from the workstation, which name is specified. When the connection is established successfully the corresponding notification is displayed. Names of table fields are displayed in a console window.

See also:

ICredentials