[midPoint] Org assignment query help

Tax, Jan tax at unc.edu
Wed Sep 22 15:25:13 CEST 2021


Hello,

I am trying to put together a scripted task that sends a notification email to each member of an org. The task performs correctly when I use the OID to specify the group, but since OIDs for orgs are generated when the org is created, I would like to reference the org by name. I can’t seem to get that to work.

I have been using the Query Playground to test the queries. Here is a query that uses OID:

<q:QueryType xmlns:q="http://prism.evolveum.com/xml/ns/public/query-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: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" xsi:type="q:QueryType">
    <q:filter>
        <q:type>
            <q:type>c:UserType</q:type>
            <q:filter>
                <q:exists>
                    <q:path>c:assignment</q:path>
                    <q:filter>
                        <q:ref>
                            <q:path>c:targetRef</q:path>
                            <q:value oid="473aa64d-3940-46da-b54b-43a0292c592b" relation="q:any" type="c:OrgType" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="c:ObjectReferenceType">
                           </q:value>
                        </q:ref>
                    </q:filter>
                </q:exists>
            </q:filter>
        </q:type>
    </q:filter>
</q:QueryType>

It returns four people assigned to my test org.

My attempt to reference the org by name :


<q:QueryType xmlns:q="http://prism.evolveum.com/xml/ns/public/query-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: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" xsi:type="q:QueryType">

    <q:filter>

        <q:type>

            <q:type>c:UserType</q:type>

            <q:filter>

                <q:exists>

                    <q:path>c:assignment</q:path>

                    <q:filter>

                        <q:ref>

                            <q:path>c:targetRef</q:path>

                            <q:value relation="q:any" type="c:OrgType" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="c:ObjectReferenceType">

    <q:filter>

        <q:type>

            <q:type>c:ObjectReferenceType</q:type>

            <q:filter>

                <q:equal>

                    <q:path>c:name</q:path>

                    <q:value>test-org</q:value>

                </q:equal>

            </q:filter>

        </q:type>

    </q:filter>

                            </q:value>

                        </q:ref>

                    </q:filter>

                </q:exists>

            </q:filter>

        </q:type>

    </q:filter>

</q:QueryType>

The inner query to find the org works correctly, but when I put in in the context of the assignment query, it returns people assigned to all orgs, not just the one org I have specified.

Any guidance is appreciated.

Jan
--
Johannes (Jan) Tax
ITS Identity Management
University of North Carolina at Chapel Hill
+1 919 962 5642



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20210922/da40e507/attachment-0001.htm>


More information about the midPoint mailing list