Example of Dashboard report: Using policySituation for report

Last modified 25 Apr 2024 10:39 +02:00

Please see Dashboard configuration for basic information about configuration variables.

Example Use-case

The Administrator needs to display all users which have value of description set as 'Created by mP'

Configuration

At first, we need to configure a policy rule. In this Example we add the following snippet of configuration to our system configuration in Midpoint.

Example System Config configuration

Git

<systemConfiguration>
    ...
    <globalPolicyRule>
        <name>test</name>
        <policyConstraints>
            <objectState>
                <filter>
                    <text>description = 'Created by midPoint'</text>
                </filter>
            </objectState>
        </policyConstraints>
        <policySituation>#userCreatedByMidpoint</policySituation>
        <policyActions>
            <record/>
        </policyActions>
        <focusSelector>
            <type>UserType</type>
        </focusSelector>
    </globalPolicyRule>
    ...
</systemConfiguration>

Now, we have to recompute all users in order to set our policySituation for them, when they meet the criteria of our filter.

Afterwards We need to configure object collection for users with policySituation.

Example ObjectCollection configuration

Git

<objectCollection xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
                  xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
                  xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3"
                  xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
                  xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3"
                  oid="72b1f98e-f587-4b9f-b92b-72e251dbb266">
    <name>Users with policySituation</name>
    <type>UserType</type>
    <filter>
        <q:text>policySituation = '#userCreatedByMidpoint'</q:text>
    </filter>
</objectCollection>

When we have the object collection in place, we want to set up an import Dashboard object with a widget for our object collection.

Example Dashboard configuration

Git

<dashboard oid="72b1f98e-f587-4b9f-b92b-72e251da3456">
    <name>users-created-by-mp-dashboard</name>
    <display>
        <label>Users created by mP dashboard</label>
    </display>
    <widget>
        <identifier>users</identifier>
        <display>
            <label>Users created by mP</label>
            <color>#00a65a</color>
            <icon>
                <cssClass>fa fa-user</cssClass>
            </icon>
        </display>
        <data>
            <sourceType>objectCollection</sourceType>
            <collection>
                <collectionRef oid="72b1f98e-f587-4b9f-b92b-72e251dbb266" type="ObjectCollectionType"/>
            </collection>
        </data>
        <presentation>
            <dataField>
                <fieldType>value</fieldType>
                <expression>
                    <proportional>
                        <style>value-only</style>
                    </proportional>
                </expression>
            </dataField>
            <dataField>
                <fieldType>unit</fieldType>
                <expression>
                    <value>users</value>
                </expression>
            </dataField>
        </presentation>
    </widget>
</dashboard>

After the successful import of the dashboard object you can see the dashboard in the menu Dashboards > Users created by mP dashboard.

We want to report it out as a table of users created by Midpoint, for this we can use a dashboard report.

Example Dashboard Report Configuration

Git

<report xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
        xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
        xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"
        xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3"
        xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
        xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"
        xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        oid="0cca4aec-22ca-4a7d-9f8a-770dc75c3d36">
    <name>Users created by midPoint dashboard report</name>
    <assignment>
        <targetRef oid="00000000-0000-0000-0000-000000000170" relation="org:default" type="c:ArchetypeType"/>
        <activation>
            <effectiveStatus>enabled</effectiveStatus>
        </activation>
    </assignment>
    <archetypeRef oid="00000000-0000-0000-0000-000000000170" relation="org:default" type="c:ArchetypeType"/>
    <roleMembershipRef oid="00000000-0000-0000-0000-000000000170" relation="org:default" type="c:ArchetypeType"></roleMembershipRef>
    <dashboard>
        <dashboardRef oid="72b1f98e-f587-4b9f-b92b-72e251da3456" relation="org:default" type="c:DashboardType"/>
    </dashboard>
</report>

Now we can run the report in the report menu, open the task which generated the report and download the report.

Was this page helpful?
YES NO
Thanks for your feedback