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 assigned a non-void value to during the credentials setting, then for the workstation block checking and registering in the access report the specified property value is used, else the name of the workstation, on which the process is run, is used instead.

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