Page tree
Skip to end of metadata
Go to start of metadata

Please see Dashboard configuration for basic information about configuration variables and Auditing-Custom column for steps how to add custom column.


Administrator needs display all audit events which contains delta with changes on administrativeStatus of account on resource R1


As first we need add custom column to m_audit_event table, on it use next sql commands:

Adding new custom column
ALTER TABLE m_audit_event ADD custSituation VARCHAR(255);
CREATE INDEX iAuditEventCustSituation
    ON m_audit_event (custSituation);

As next adding we adding next snippet of configuration to config.xml file in Midpoint home directory.

config.xml confiuration snippet

After modifying config.xml we have to restart Midpoint. As last part of adding custom column adding next configuration to system configuration. 

Snippet of system configuration
                    <script xmlns:xsi="" xmlns:c="" xsi:type="c:ScriptExpressionEvaluatorType">
                          import com.evolveum.midpoint.schema.ObjectDeltaOperation;
                           import com.evolveum.midpoint.prism.path.ItemPath;
                           import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
                           ret = "";
                           if (target instanceof UserType) {
                              for (ObjectDeltaOperation delta : auditRecord.getDeltas()) {
                                 if ("---RESOURCE_OID---".equals(delta.getResourceOid())) {
                                    for (ItemDelta itemDelta : delta.getObjectDelta().getModifications()){
                                       if (itemDelta.getPath().equivalent(ItemPath.create(UserType.F_ACTIVATION, ActivationType.F_ADMINISTRATIVE_STATUS))){
                                          if (!ret.isEmpty()){
                                             ret = ret + "|";
                                          ret = ret + "changeAdminStatR1";
                           return ret

Please replace '---RESOURCE_OID---' with oid of your resource. I chose situations are split by '|', but you can use more columns. Now, we need configure object collection for audit records. In object collection for audit events we use sql select command.

Object collection
<objectCollection oid="72b1f98e-f587-4b9f-b92b-72e251dbb277">
    <name>Modification of administrative attribute</name>
        <recordQuery>select * from m_audit_event as aer where aer.eventType=2 and aer.eventStage=1 and aer.custSituation LIKE '%changeAdminStatR1%'</recordQuery>

When we have object collection, then import Dashboard object with widget for our object collection.

<dashboard oid="72b1f98e-f587-4b9f-b92b-72e251da4567">
        <label>Changes of administrativeStatus(R1)</label>
            <label>Changes of administrativeStatus(R1)</label>
                <cssClass>fa fa-database</cssClass>
                <collectionRef oid="72b1f98e-f587-4b9f-b92b-72e251dbb277" type="ObjectCollectionType"/>

After successful import of dashboard object and reload of page you can see dashboard in menu DashboardsChanges of administrativeStatus(R1).

We want report with table of audit events, so we import dashboard report. 

    <name>Changes of administrativeStatus(R1) dashboard report</name>
        <dashboardRef oid="72b1f98e-f587-4b9f-b92b-72e251da4567" type="DashboardType"/>

Now we can run report in report menu, show task, and download report. Every report from dashboard is in HTML format. 

  • No labels