IMetabaseCustomEvents.OnBeforeLogon

Syntax

OnBeforeLogon(Args: IMetabaseOnBeforeLogonArgs);

OnBeforeLogon(Args: Prognoz.Platform.Interop.Metabase.IMetabaseOnBeforeLogonArgs);

Description

The OnBeforeLogon method implements the event that occurs before repository connection using web service.

Comments

The method must be redefined in a user class. The method use enables redefine repository connection parameters or execute any additional actions on connection.

For repository connection, the OpenMetabase operation is used.

Example

The specified example in general way represents the class that can be used to handle connection event to repository from web service.

Public Class CustomEvents: ForeMetabaseCustomEvents
    
Public Sub OnBeforeLogon(Args: IMetabaseOnBeforeLogonArgs);
    
Var
        Def: IMetabaseDefinition;
        SecPackage: ISecurityPackage;
        Creds: IPasswordCredentials;
    
Begin
        
If True Then
            Args.Handled := 
False;
            Args.AllowLogon := 
True;
            Args.ResultMetabase := Args.Metabase;
        
Else
            Args.Handled := 
True;
            Args.AllowLogon := 
True;
            Def := Args.Metabase.Definition;
            
//...
            //Change connection parameters
            ///...
            SecPackage := New StandardSecurityPackage.Create;
            Creds := SecPackage.CreateCredentials(AuthenticationMode.Password) 
As IPasswordCredentials;
            Creds.UserName := (Args.Credentials 
As IPasswordCredentials).UserName;
            Creds.Password := 
"new password";
            
//...
            //Set up credentials
            //...
            Args.ResultMetabase := Def.Open(Creds);
        
End If;
    
End Sub OnBeforeLogon;
End Class CustomEvents ;

See also:

IMetabaseCustomEvents