LogonEvent: IMetabaseLogonEvents;
The LogonEvent property determines the use of events when connecting to the repository.
Executing the example requires the Oracle 12.x\18.x driver set in repository description settings.
Class MyMetabaseLogonEvents: MetabaseLogonEvents
Public Sub OnLogonUserMustChangePassword(Connection: IDalConnectionExt; Var Result: Boolean);
Begin
Result := True;
Connection.ChangeExpiredPassword("12345");
End Sub OnLogonUserMustChangePassword;
End Class MyMetabaseLogonEvents;
Sub Connect;
Var
Mb: IMetabase;
MbManager: IMetabaseManager;
MbDef: IMetabaseDefinition;
Package: ISecurityPackage;
Credentials: IPasswordCredentials;
spld: ISecurityPackageLogonData;
mle: IMetabaseLogonEvents;
Begin
Try
MbManager := MetabaseManagerFactory.Active;
MbDef := MbManager.Definitions.FindById("Warehouse");
Package := MbManager.Packs.FindById(MbDef.SecurityPackage).Package;
Credentials := Package.CreateCredentials(AuthenticationMode.Password) As IPasswordCredentials;
Credentials.UserName := "User102";
Credentials.Password := "123";
mle := New MyMetabaseLogonEvents.Create;
spld := MbDef.LogonData;
spld.LogonEvent := mle;
mb := MbDef.Open(Credentials);
Except On E: Exception Do
Debug.WriteLine("Error on opening repository");
Debug.WriteLine("Error text: " + E.Message);
Raise New Exception.Create(E.Message);
End Try;
End Sub Connect;
On performing the Connect procedure connection to repository is established. If user password is expired, it will be changed.
See also: