[midPoint] Org assignment query help
Tax, Jan
tax at unc.edu
Thu Sep 23 20:43:49 CEST 2021
Thanks Paul!
That worked, and got me to find the section of the Query API documentation about special symbols in item paths.
Jan
From: Paul Engle <pengle at rice.edu>
Date: Thursday, September 23, 2021 at 10:09 AM
To: midPoint General Discussion <midpoint at lists.evolveum.com>
Cc: Tax, Jan <tax at unc.edu>
Subject: Re: [midPoint] Org assignment query help
You can use the @ symbol in a path name to dereference something and
get to the attributes of the referenced object. So, in your original
query, you can replace the inner filter with something like:
<q:filter>
<q:equal>
<q:path>c:targetRef/@/name</q:path>
<q:value>foo</q:value>
</q:equal>
</q:filter>
to get the members of an Org named 'foo'.
--
Paul Engle
IAM Architect
Identity & Access Management
pengle at rice.edu 713-348-4702
On Wed, Sep 22, 2021 at 8:25 AM Tax, Jan via midPoint
<midpoint at lists.evolveum.com> wrote:
>
>
>
> 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
>
>
>
>
>
>
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> https://lists.evolveum.com/mailman/listinfo/midpoint
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20210923/7e52430a/attachment-0001.htm>
More information about the midPoint
mailing list