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

<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2010-2024 Evolveum
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<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

<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2010-2024 Evolveum
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<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

<!--
  ~ Copyright (c) 2010-2024 Evolveum
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<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

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