[midPoint] Writing a query using the ouput of an other query.
Sébastien MARBRIER
smarbrier at positivethinking.tech
Wed Jun 8 16:52:56 CEST 2022
Hello Anton,
Yes, it works perfectly.
Now , it would be perfect if I could make the output more detailed.
I am going to check the documentation for it.
Maybe using a report would be the right option ?
Thank you very much for your nice help.
Best regards,
[logo]<https://www.positivethinking.tech/>
Sébastien Marbrier | Senior IT Consultant
smarbrier at positivethinking.tech<mailto:smarbrier at positivethinking.tech>
Tel. +41 21 601 81 00<tel:+41%2021%20601%2081%2000>
[Teams chat]<https://teams.microsoft.com/l/chat/0/0?users=smarbrier@positivethinking.tech>
<https://teams.microsoft.com/l/chat/0/0?users=smarbrier@positivethinking.tech>
Chat with me on Teams<https://teams.microsoft.com/l/chat/0/0?users=smarbrier@positivethinking.tech>
[cid:image003.png at 01D87B58.30B0A0D0]<https://www.linkedin.com/company/the-positive-thinking-company/> [cid:image004.png at 01D87B58.30B0A0D0] <https://www.instagram.com/positivethinkingcompany/> [cid:image005.png at 01D87B58.30B0A0D0] <https://twitter.com/PTC_Tech> [cid:image006.png at 01D87B58.30B0A0D0] <https://youtube.com/channel/UCfaImWa6r0IoZoUYLhbiF7w>
Avenue de cour, 135 – 1007 Lausanne
www.positivethinking.tech<https://www.positivethinking.tech/>
From: Tony Tkacik <tony.tkacik at evolveum.com>
Sent: mercredi, 8 juin 2022 11:41
To: midPoint General Discussion <midpoint at lists.evolveum.com>
Cc: Sébastien MARBRIER <smarbrier at positivethinking.tech>
Subject: Re: [midPoint] Writing a query using the ouput of an other query.
Hi Sebastien,
In your case since you use orgRef with scope ONE_LEVEL, this could be easily rewritten to ref filter with dereference (aka "JOIN", see for https://docs.evolveum.com/midpoint/reference/concepts/query/query-api/#special-symbols-in-item-paths ).
The filter you are looking for is following:
Object Type: UserType
<query>
<filter>
<ref>
<path>parentOrgRef/@/roleMembershipRef</path>
<value oid="oid of the meta role" />
</ref>
</filter>
</query>
Notice the path and @ symbol, in this case this means we are looking into parentOrgRef, the @ symbol represents dereference (aka use values from ref target) and now we can use roleMembershipRef in ref filter.
This filter is translated into following hibernate query in Query Playground:
select u.oid, u.fullObject from RUser u
left join u.parentOrgRef p
left join p.target t
left join t.roleMembershipRef r
where
(
r.targetOid = :targetOid and
r.relation in (:relation)
)
I tested this filter on 4.0.4 and it works that it selects all users in organization units, which has assigned meta role.
Hope this helps.
Anton Tkacik
________________________________
From: "midPoint General Discussion" <midpoint at lists.evolveum.com<mailto:midpoint at lists.evolveum.com>>
To: "midPoint General Discussion" <midpoint at lists.evolveum.com<mailto:midpoint at lists.evolveum.com>>
Cc: "Sébastien MARBRIER" <smarbrier at positivethinking.tech<mailto:smarbrier at positivethinking.tech>>
Sent: Tuesday, June 7, 2022 5:07:20 PM
Subject: [midPoint] Writing a query using the ouput of an other query.
Hello dear midpoint users.
I need to list the users which are a members of organizations which are member of a given metarole.
I can get the list of the organizations using this simple query in the query playground:
Object type : OrgType
<query>
<filter>
<ref>
<path>roleMembershipRef</path>
<value oid="oid of the meta role/>
</ref>
</filter>
</query>
I can also get of the users of such an organization using this other simple query:
Object Type : UserType
<query>
<filter>
<org>
<orgRef>
<oid>oid of an organization</oid>
</orgRef>
<scope>ONE_LEVEL</scope>
</org>
</filter>
</query>
However I am clueless how it is possible to mixing those two queries to automate the listing process.
Doing this by hand is a bit too tedious because there too many organizations.
Alternative suggestions are welcome.
I am using a 4.0.1 version of midpoint.
Best regards,
[logo]<https://www.positivethinking.tech/>
Sébastien Marbrier | Senior IT Consultant
smarbrier at positivethinking.tech<mailto:smarbrier at positivethinking.tech>
Tel. +41 21 601 81 00
[Teams chat]<https://teams.microsoft.com/l/chat/0/0?users=smarbrier@positivethinking.tech>
<https://teams.microsoft.com/l/chat/0/0?users=smarbrier@positivethinking.tech>
Chat with me on Teams<https://teams.microsoft.com/l/chat/0/0?users=smarbrier@positivethinking.tech>
[cid:image003.png at 01D87B58.30B0A0D0]<https://www.linkedin.com/company/the-positive-thinking-company/> [cid:image004.png at 01D87B58.30B0A0D0] <https://www.instagram.com/positivethinkingcompany/> [cid:image005.png at 01D87B58.30B0A0D0] <https://twitter.com/PTC_Tech> [cid:image006.png at 01D87B58.30B0A0D0] <https://youtube.com/channel/UCfaImWa6r0IoZoUYLhbiF7w>
Avenue de cour, 135 – 1007 Lausanne
www.positivethinking.tech<https://www.positivethinking.tech/>
________________________________
Positive Thinking Company puts security at a high priority in its conduct of business. Therefore, we have put our best efforts into ensuring that this email and its attached documents are error and virus-free. Nonetheless, full security of emails/documents cannot be ensured. Therefore, the recipient is responsible for checking the email/documents for threats with its own security measures, prior to opening it. Positive Thinking Company does not accept liability for any damage inflicted by using the content of this email/documents. If you are not the intended recipient, please notify the sender and delete this email/document.
_______________________________________________
midPoint mailing list
midPoint at lists.evolveum.com<mailto:midPoint at lists.evolveum.com>
https://lists.evolveum.com/mailman/listinfo/midpoint
________________________________
Positive Thinking Company puts security at a high priority in its conduct of business. Therefore, we have put our best efforts into ensuring that this email and its attached documents are error and virus-free. Nonetheless, full security of emails/documents cannot be ensured. Therefore, the recipient is responsible for checking the email/documents for threats with its own security measures, prior to opening it. Positive Thinking Company does not accept liability for any damage inflicted by using the content of this email/documents. If you are not the intended recipient, please notify the sender and delete this email/document.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220608/9c6409fa/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 7735 bytes
Desc: image001.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220608/9c6409fa/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 686 bytes
Desc: image002.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220608/9c6409fa/attachment-0007.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 2337 bytes
Desc: image003.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220608/9c6409fa/attachment-0008.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 2756 bytes
Desc: image004.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220608/9c6409fa/attachment-0009.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image005.png
Type: image/png
Size: 2358 bytes
Desc: image005.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220608/9c6409fa/attachment-0010.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image006.png
Type: image/png
Size: 2669 bytes
Desc: image006.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220608/9c6409fa/attachment-0011.png>
More information about the midPoint
mailing list