<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}
span.E-MailFormatvorlage20
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="DE" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">Hi Sebastian,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">try the following:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">Collection<UserType> managers = midpoint.getManagers(focus);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">UserType manager = null;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">If(managers != null && !managers.isEmpty()) {<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US"> manager = managers.getAt(0);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US"> …<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">Kind regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">Fabian<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">--<o:p></o:p></span></p>
<div>
<div>
<div>
<p class="MsoNormal"><b><span style="font-family:"Verdana",sans-serif;color:black;mso-fareast-language:EN-US">Fabian Noll-Dukiewicz</span></b><b><span style="font-size:11.0pt;font-family:"Verdana",sans-serif;color:black;mso-fareast-language:EN-US"><o:p></o:p></span></b></p>
<p class="MsoNormal"><i><span style="font-family:"Verdana",sans-serif;color:black;mso-fareast-language:EN-US">Spezialist Identity & Access Management | Geschäftsführer<o:p></o:p></span></i></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Verdana",sans-serif;color:black;mso-fareast-language:EN-US">Tel.: +49 152 244 63 211<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Verdana",sans-serif;color:black;mso-fareast-language:EN-US">Email: fabian.noll-dukiewicz@fndit.de<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Verdana",sans-serif;color:black;mso-fareast-language:EN-US">Web:
<a href="https://www.fndit.de">https://www.fndit.de</a> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Verdana",sans-serif;color:black;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Verdana",sans-serif;color:black;mso-fareast-language:EN-US">--<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Verdana",sans-serif;color:black;mso-fareast-language:EN-US">FND IT Solutions UG (haftungsbeschränkt)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Verdana",sans-serif;color:black;mso-fareast-language:EN-US">Kaiser-Friedrich-Str. 16B<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Verdana",sans-serif;color:black;mso-fareast-language:EN-US">14469 Potsdam<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Verdana",sans-serif;color:black;mso-fareast-language:EN-US">Sitz der Gesellschaft: Potsdam<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Verdana",sans-serif;color:black;mso-fareast-language:EN-US">Registergericht: Amtsgericht Potsdam, HRB 34452<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Verdana",sans-serif;color:black;mso-fareast-language:EN-US">Geschäftsführer: Fabian Noll-Dukiewicz</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
</div>
</div>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">Von:
</span></b><span style="font-size:12.0pt;color:black">Dornieden, Sebastian <Sebastian.Dornieden@comramo.de><br>
<b>Datum: </b>Dienstag, 26. April 2022 um 16:20<br>
<b>An: </b>midpoint@lists.evolveum.com <midpoint@lists.evolveum.com><br>
<b>Betreff: </b>[midPoint] Get manager of User for Active Directory<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Hey together,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">i have trouble to get the manager of a user and fill the ad-attribute with the dn of the manager.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Im using the mapping at the bottom.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">My problem:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">getManagers(user) gives me the managers of all parent orgs in a confusing random order but i only need to get the manager which is directly assigned to the users org.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Do you have any hint form e?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Kind regards<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><attribute><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> <ref>ri:manager</ref><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> <outbound><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> <expression><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> <script><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> <code><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> import static com.evolveum.midpoint.schema.constants.SchemaConstants.*<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> tmpManagers = midpoint.getManagers(user)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> managerUser = null<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> if (!tmpManagers?.isEmpty()) managerUser
= tmpManagers.stream()<!--.skip(1)-->.iterator().next()<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> if (managerUser) {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> managerShadow = midpoint.getLinkedShadow(managerUser,'a358208b-bda2-480b-8d04-4ca2991078db',
ShadowKindType.ACCOUNT, 'default')<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> if (managerShadow) {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> managerDn
= basic.getAttributeValue(managerShadow,'http://midpoint.evolveum.com/xml/ns/public/resource/instance-3', 'dn')<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> return
managerDn<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> return null<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> </code><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> </script><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> </expression><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> </outbound><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> </attribute><o:p></o:p></span></p>
<p>Sebastian Dornieden<span style="font-size:10.0pt"><br>
</span>IT-Administrator <span style="font-size:10.0pt"><br>
</span>Abteilung Informationstechnologie<span style="font-size:10.0pt"><br id="c1-id-11">
<br>
</span>COMRAMO AG<span style="font-size:10.0pt"><br id="c1-id-14">
</span>Bischofsholer Damm 89<span style="font-size:10.0pt"><br id="c1-id-15">
</span>30173 Hannover<span style="font-size:10.0pt"><br>
<br>
</span>Handelsregister: Hannover HRB 56111<span style="font-size:10.0pt"><br id="c1-id-18">
</span>Geschäftsführer: Herr Peter Nohr<span style="font-size:10.0pt"><br>
<br id="c1-id-21">
</span>Mail: Sebastian.Dornieden@comramo.de<span style="font-size:10.0pt"><br id="c1-id-23">
</span>Web: www.comramo.de<span style="font-size:10.0pt"><br>
<br>
</span>Hotline der Abteilung Informationstechnologie:<span style="font-size:10.0pt"><br>
</span>+49 511 12401-767 <span style="font-family:"Arial",sans-serif"><o:p></o:p></span></p>
<p><span style="font-size:8.0pt">Diese Information ist ausschließlich für den Adressaten bestimmt und kann vertraulich oder gesetzlich geschützte Informationen enthalten. Wenn Sie nicht der bestimmungsgemäße Adressat sind, unterrichten Sie bitte den Absender
und vernichten Sie diese Mail. Anderen als dem bestimmungsgemäßen Adressaten ist es untersagt, diese E-Mail zu lesen, zu speichern, weiterzuleiten oder ihren Inhalt auf welche Weise auch immer zu verwenden.</span><span style="font-size:10.0pt;font-family:"Arial",sans-serif"><o:p></o:p></span></p>
<p><span style="font-size:8.0pt">Diese E-Mail enthält kein Anerkenntnis, dass es sich beim Inhalt dieser E-Mail um eine rechtsverbindliche Erklärung der COMRAMO AG handelt. Erklärungen, welche die COMRAMO AG verpflichten, bedürfen jeweils der Unterschrift der
zeichnungsberechtigten Person der COMRAMO AG. Die Allgemeinen Geschäftsbedingungen der COMRAMO AG finden Sie auf www.comramo.de und können sie dort als PDF-Datei herunterladen. Bitte beachten Sie unsere Datenschutzhinweise: https://www.comramo.de/datenschutz/
</span><span style="font-size:10.0pt;font-family:"Arial",sans-serif"><o:p></o:p></span></p>
</div>
</body>
</html>