UserDescription: String;
The UserDescription property determines full user name to write it into the access protocol.
The user full name is used in paper marking when printing out or exporting, if mandatory access is used.
Executing the example requires the use of mandatory access in the repository. The schema must contain the regular report with the Test identifier, the report's access level, at which the connection to the repository is established, must coincide with the one of the UserTest user. Administrator must add the 1a2b3c4d5e6f certificate to the UserTest user. For access level, the document marking on exporting and printing is enabled. The form must contain the button, the DocumentPrinter component and the UiReport. The button must have the OnClick event description, the form - OnCreate.
Class TestForm: Form
Button1: Button;
UiReport1: UiReport;
DocumentPrinter1: DocumentPrinter;
MB: IMetabase;
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
logses: ILogonSession;
dp: IDocumentPrinter;
Begin
logses := Mb.LogonSession;
Debug.WriteLine("UserOS: " + logses.UserOS + " UserDescription: " + logses.UserDescription);
UiReport1.Instance := Mb.ItemById("Test").OpenWithParam(Null);
dp := New DocumentPrinter.Create;
dp.Source := uireport1 As IDocumentSource;
dp.PrintPreview;
End Sub Button1OnClick;
Sub TestFormOnCreate(Sender: Object; Args: IEventArgs);
Var
MbManager: IMetabaseManager;
MbDef: IMetabaseDefinition;
Credentials: IPasswordCredentials;
Package: ISecurityPackage;
Begin
Mb := Null;
MbManager := MetabaseManagerFactory.Active;
MbDef := MbManager.Definitions.FindById("student0");
Debug.AssertMsg(MbDef <> Null, "The metabase description not found");
Package := MbManager.Packs.FindById(MbDef.SecurityPackage).Package;
Credentials := Package.CreateCredentials(AuthenticationMode.Password) As IPasswordCredentials;
Credentials.UserOS := "MyUserOS";
Credentials.UseUserOSForDocumentLabels := True;
Credentials.UserDescription := "MyDescription";
Credentials.UserName := "UserTest";
Credentials.Password := "UserTest";
Credentials.UserCertificate := "1a2b3c4d5e6f";
mb := MbDef.Open(Credentials);
End Sub TestFormOnCreate;
End Class TestForm;
On clicking the button the full OS user name and full user name of the current session are displayed in console window, after that the regular report is previewed. The specified OS user name (UserOS) and full user name (UserDescription) are indicated in the report marking. If the UseUserOSForDocumentLabels property is assigned the False value to, then the document marking indicates the info of the user, under whose account the connection (UserTest) was established.
See also: