[midPoint] Looking up a user in midpoint to get additional details
Knox, Alex
alex at austin.utexas.edu
Tue Oct 24 00:50:32 CEST 2023
Hi Kevin,
I think you might be able to use midpoint.searchObjects after all —I was able to find a user in 4.4.6 using something like this:
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType
import com.evolveum.midpoint.prism.path.ItemPath
def query = prismContext.queryFor(UserType.class)
.item(ItemPath.create(UserType.F_EXTENSION, "person_ID")).eq(manager) // might need to be (manager + "")
.build()
def users = midpoint.searchObjects(UserType.class, query)
if (users.isEmpty()) {
return null
}
return users[0].name
When I tested this in the mapping playground with an extension attribute, it would only work if I put extensionAttribute + “” in the query, rather than just extensionAttribute. Not sure if that’s just mapping playground rules.
Hope this helps!
Alex
From: midPoint <midpoint-bounces at lists.evolveum.com> on behalf of Collins, Kevin via midPoint <midpoint at lists.evolveum.com>
Date: Sunday, October 22, 2023 at 7:27 AM
To: midpoint at lists.evolveum.com <midpoint at lists.evolveum.com>
Cc: Collins, Kevin <K.J.Collins at hw.ac.uk>
Subject: [midPoint] Looking up a user in midpoint to get additional details
Hi all,
I’m _really_ stuck on how to search the midpoint repository to find a user by something other than their username and return some details about that user.
My use case is this:
1. Incoming data feed from HR contains a ‘manager’ value for each user.
2. The manager from HR value is the person_ID of the manager’s record also in the HR data feed:
* user-Y has a ‘manager’ value of ‘12345678’
* ‘12345678’ is the person_ID of user-Y’s manager
1. I need to be able to search the midpoint repo for ‘person_ID=12345678’ and get that object’s username.
2. There should be up to 1 occurrence of that person_ID, in the data since person_ID the immutable primary key in the HR data feed.
I’ve tried midpoint.searchObjectByName(UserType, …) but that only works if I already know the username of the object I’m searching for. I’m trying to _fetch_ the username from midpoint knowing only the person_ID. Same with midpoint.searchObjects(UserType, …).
I’ve tried implementing this lookup in the inbound resource and in a user template. And I’ve looked at loads of midpoint docs to see if there’s an example that I can tweak.
I’m clearly not understanding something!
Can anyone point me in the right direction?
Thanks in advance.
-Kev_C
--
Kevin Collins,
EDINBURGH, EH14 4AS,
________________________________
Founded in 1821, Heriot-Watt is a leader in ideas and solutions. With campuses and students across the entire globe we span the world, delivering innovation and educational excellence in business, engineering, design and the physical, social and life sciences. This email is generated from the Heriot-Watt University Group, which includes:
1. Heriot-Watt University, a Scottish charity registered under number SC000278
2. Heriot- Watt Services Limited (Oriam), Scotland's national performance centre for sport. Heriot-Watt Services Limited is a private limited company registered is Scotland with registered number SC271030 and registered office at Research & Enterprise Services Heriot-Watt University, Riccarton, Edinburgh, EH14 4AS.
The contents (including any attachments) are confidential. If you are not the intended recipient of this e-mail, any disclosure, copying, distribution or use of its contents is strictly prohibited, and you should please notify the sender immediately and then delete it (including any attachments) from your system.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20231023/3c2c86fc/attachment-0001.htm>
More information about the midPoint
mailing list