Example of Collection report: Users without account

Last modified 21 Feb 2022 16:23 +01:00

Please see Report configuration for basic information about configuration variables.

Usecase

We need report of users which have assignment of role, but don’t have account on our resource, and they should have.

Configuration

We need only report configuration with condition.

Report XML
<report>
    <name>Users without account</name>
    <assignment>
        <targetRef oid="00000000-0000-0000-0000-000000000171" relation="default" type="ArchetypeType">
            <!-- Collection report -->
        </targetRef>
    </assignment>
    <archetypeRef oid="00000000-0000-0000-0000-000000000171" relation="default" type="ArchetypeType">
        <!-- Collection report -->
    </archetypeRef>
    <roleMembershipRef oid="00000000-0000-0000-0000-000000000171" relation="default" type="ArchetypeType">
        <!-- Collection report -->
    </roleMembershipRef>
    <objectCollection>
        <collection>
            <filter>
                <ref>
                    <path>roleMembershipRef</path>
                    <value oid="----OID_OF_YOUR_ROLE----"/>
                </ref>
            </filter>
        </collection>
        <condition>
            <script>
                <code>
                  	linkRefs = object.getLinkRef();
                   	containsAccount = false;
                    for (linkRef in linkRefs) {
                       try {
                          shadow = midpoint.resolveReference(linkRef)
                          if (shadow != null && shadow.getResourceRef() != null && "10000000-9999-9999-0000-a000ff000004".equals(shadow.getResourceRef().getOid())) {
                             containsAccount = true;
                          }
                       } catch (Exception e) {
                       }
                    }
                    return !containsAccount;
              </code>
            </script>
        </condition>
		<view>
            <identifier>UserType</identifier>
            <column>
                <name>nameColumn</name>
                <path>name</path>
                <display>
                    <label>Name</label>
                </display>
            </column>
            <type>UserType</type>
        </view>
        <useOnlyReportView>true</useOnlyReportView>
    </objectCollection>
    <fileFormat>
        <type>csv</type>
    </fileFormat>
</report>

Please replace_ '----OID_OF_YOUR_ROLE----'_ with oid of your role and '----OID_OF_YOUR_RESOURCE----' with oid of your resource.

Was this page helpful?
YES NO
Thanks for your feedback