LogonEvent: IMetabaseLogonEvents;
The LogonEvent property determines the use of events when connecting to the database.
Executing the example requires the Oracle 9.x\10.x\11.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
Mb := Null;
MbManager := MetabaseManagerFactory.Active;
MbDef := MbManager.Definitions.FindById("PPRepository");
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 while opening metabase");
Debug.WriteLine("Text of the error: " + 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: