[midPoint] How to obtain the dn using a managers username
Roman Pudil
roman.pudil at ami.cz
Tue Sep 16 19:10:31 CEST 2025
Hi Gary,
use this code as inspiration:
<attribute>
<ref>ri:manager</ref>
<displayName>Manager</displayName>
<tolerant>false</tolerant>
<outbound>
<authoritative>true</authoritative>
<strength>strong</strength>
<source>
<path>$focus/activation/effectiveStatus</path>
</source>
<expression>
<script>
<code><![CDATA[
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType;
import com.evolveum.midpoint.prism.query.ObjectQuery;
import com.evolveum.midpoint.prism.path.ItemName;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
def nrManager = basic.getExtensionPropertyValue(focus, 'perNrManager');
if (!nrManager) return null;
ObjectQuery query = prismContext.queryFor(UserType.class)
.item(new ItemName(SchemaConstants.NS_C, 'personalNumber')).eq((nrManager ?: '999999999'))
.build();
def manager = midpoint.repositoryService.searchObjects(UserType.class, query, null, midpoint.getCurrentResult())?.find()?.asObjectable();
if (!manager) return null;
def managerAD = midpoint.getLinkedShadow(manager, "11111102-8d07-4dca-b2fe-c18889afa104", ShadowKindType.ACCOUNT, "user", true);
if (managerAD) return managerAD?.name;
]]></code>
</script>
</expression>
<condition>
<script>
<code><![CDATA[
import com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType;
return effectiveStatus?.equals(ActivationStatusType.ENABLED);
]]></code>
</script>
</condition>
</outbound>
</attribute>
Regards
Roman Pudil
solution architect
gsm: [+420] 775 663 666
e‑mail: roman.pudil at ami.cz<mailto:roman.pudil at ami.cz>
AMI Praha a.s.
Pernerova 697/35, 186 00 Praha 8
recepce: [+420] 604 444 848 | web: www.ami.cz<https://www.ami.cz/>
[AMI Praha a.s.]
Textem tohoto e‑mailu podepisující neslibuje uzavřít ani neuzavírá za společnost AMI Praha a.s.
jakoukoliv smlouvu. Každá smlouva, pokud bude uzavřena, musí mít výhradně písemnou formu.
Tento e‑mail je určen výhradně pro potřeby jeho adresáta/ů a může obsahovat důvěrné nebo osobní
informace. Nejste‑li zamýšleným příjemcem, je zakázáno jakékoliv zveřejňování, zprostředkování
nebo jiné použití těchto informací. Pokud jste obdrželi e‑mail neoprávněně, informujte o tom prosím
odesílatele a vymažte neprodleně všechny kopie tohoto e‑mailu včetně všech jeho příloh. Nakládáním
s neoprávněně získanými informacemi se vystavujete riziku právního postihu.
------ Původní zpráva ------
Od "Maxwell, Gary via midPoint" <midpoint at lists.evolveum.com<mailto:midpoint at lists.evolveum.com>>
Komu "'midpoint at lists.evolveum.com'" <midpoint at lists.evolveum.com<mailto:midpoint at lists.evolveum.com>>
Kopie "Maxwell, Gary" <Maxwell_G at fortlewis.edu<mailto:Maxwell_G at fortlewis.edu>>
Datum 16.09.2025 18:26:08
Předmět [midPoint] How to obtain the dn using a managers username
Is it possible to search for the dn of a employees' manager in an Active Directory resource in Midpoint 4.4?
As we provision an employee to active directory, we would like use the employees' manager username to find the manager dn to set the manager attribute for that employee. Is there any way to do this in Midpoint 4.4.
Any Ideas?
-Gary
_______________________________________________
midPoint mailing list
midPoint at lists.evolveum.com<mailto:midPoint at lists.evolveum.com>
https://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.evolveum.com%2Fmailman%2Flistinfo%2Fmidpoint&data=05%7C02%7Croman.pudil%40ami.cz%7C1536750a28df42e3281608ddf53dc6aa%7C61ffc580ac524580a5885ba8429a3177%7C0%7C0%7C638936367871437987%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=jbPY8Ynf99H4CzTrVnFrXEfhU%2FBgO7cUt7U84o%2B93FE%3D&reserved=0<https://lists.evolveum.com/mailman/listinfo/midpoint>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20250916/570984c9/attachment-0001.htm>
More information about the midPoint
mailing list