Session: Integer;
Session: uinteger;
The Session property returns a number of the session.
To execute the example, add a link to the Metabase system assembly.
Sub UserProc;
Var
MB: IMetabase;
MS: IMetabaseSecurity;
AL: IAuditLog;
ALogon: IAuditLogons;
Lic: Object;
Begin
MB := MetabaseClass.Active;
// Get license to work with security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
MS := MB.Security;
// Open access protocol
Al := MS.OpenAuditLog;
ALogon := AL.OpenLogons(False);
// Display to console information about current repository sessions
While Not ALogon.Eof Do
Debug.WriteLine("Session: " + ALogon.Session.ToString);
Debug.WriteLine("User: " + ALogon.UserName + "; Description: " + ALogon.UserDescription + "; Sid: " + ALogon.UserSid);
Debug.WriteLine("Workstation: " + ALogon.Station + "; OS user: " + ALogon.UserOS + "; IP: " + ALogon.UserIP);
ALogon.Next;
End While;
// Check in license
Lic := Null;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.ForeSystem;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MS: IMetabaseSecurity;
AL: IAuditLog;
ALogon: IAuditLogons;
Lic: Object;
Begin
MB := Params.Metabase;
// Get license to work with security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.lftAdm);
MS := MB.Security;
// Open access protocol
Al := MS.OpenAuditLog();
ALogon := AL.OpenLogons(False);
// Display to console information about current repository sessions
While Not ALogon.Eof() Do
System.Diagnostics.Debug.WriteLine("Session: " + ALogon.Session.ToString());
System.Diagnostics.Debug.WriteLine("User: " + ALogon.UserName + "; Description: " + ALogon.UserDescription + "; Sid: " + ALogon.UserSid);
System.Diagnostics.Debug.WriteLine("Workstation: " + ALogon.Station + "; OS user: " + ALogon.UserOS + "; IP: " + ALogon.UserIP);
ALogon.Next();
End While;
// Check in license
Lic := Null;
End Sub;
After executing the example the information about the sessions with the current repository is displayed in the development environment console. The following information will be displayed: the number of the session; name, description and SID (security subject identifier) of the user, under which the connection to the platform was performed. And also a name of the workstation, the user name under which the entry to the operating system was done and IP of the workstation are displayed.
See also: