ISecuritySnapshotCallback.OnOperation

Syntax

OnOperation(ApplyOperation: SnapshotApplyOperationType; Var State: Integer);

Parameters

ApplyOperation. A type of the operation that is performed when applying security policy;

State. A state.

Description

The OnOperation method implements an event that takes place while using the security policy.

Example

Class CSnapBack : SecuritySnapshotCallback

 

Public Constructor Create;

Begin

End Constructor Create;

 

Public Sub OnSubjectApply(ApplyState: ApplyStateType; Subject: ISecuritySubject; Var State: Integer);

Begin

Debug.WriteLine("OnSubjectApply " + Subject.Name + " " + CultureInfo.Current.FormatTime(DateTime.Now) + " - " + ApplyState.ToString);

End Sub OnSubjectApply;

 

Public Sub OnOperation(ApplyOperation: SnapshotApplyOperationType; Var State: Integer);

Begin

Debug.WriteLine("OnOperation: " + CultureInfo.Current.FormatTime(DateTime.Now) + " - " + ApplyOperation.ToString);

End Sub OnOperation;

 

End Class CSnapBack;

 

Sub Main;

Var

MB : IMetabase;

SE : IMetabaseSecurity;

SS : ISecuritySnapshot;

SSL : ISecuritySnapshotLog;

i : Integer;

CallBack : CSnapBack;

Begin

MB := MetabaseClass.Active;

SE := MB.Security;

SS := SE.NewSnapshot;

CallBack := New CSnapBack.Create;

SS.ApplyFromFile("C:\test.pppolicy", CallBack);

SSL := SS.Log;

For i := 0 To SSL.Fields.Count - 1 Do

Debug.Write((SSL.Fields.Item(i).Name As String) + " ");

End For;

Debug.WriteLine("");

While Not SSL.Eof Do

For i := 0 To SSL.Fields.Count-1 Do

If SSL.Fields.Item(i).Name = "APST" Then

Select Case (SSL.Fields.Item(i).Value As Integer)

Case 0 : Debug.Write("None ");

Case 1 : Debug.Write("Create ");

Case 2 : Debug.Write("Change ");

Case 3 : Debug.Write("Error ");

Case 4 : Debug.Write("Deleted ");

End Select;

Else

Debug.Write((SSL.Fields.Item(i).Value As String) + " ");

End If;

End For;

SSL.Next;

Debug.WriteLine("");

End While;

End Sub Main;

After executing the example information about performed operations when applying security policy, as well as detailed list of groups/users and manipulations, performed with them, are displayed in the console window.

See also:

ISecuritySnapshotCallback