<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 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.
  -->
<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="dd6d6a32-596b-4512-aa18-f1f0c1e7c19b">
    <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>
                <q:text>roleMembershipRef matches (oid = '6f60f403-aba0-4718-aae9-b33b9d2a01df')</q:text>
            </filter>
        </collection>
        <condition>
            <script>
                <code>
                  	linkRefs = object.getLinkRef();
                   	containsAccount = false;
                    for (linkRef in linkRefs) {
                       try {
                          shadow = midpoint.resolveReference(linkRef)
                          if (shadow != null &amp;&amp; shadow.getResourceRef() != null &amp;&amp; "ef2bc95b-76e0-59e2-86d6-9999cccccccc".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>