[midPoint] Receive value of parentOrg attribute in mapping

Jason Everling jeverling at bshp.edu
Wed May 8 15:39:20 CEST 2019


within the mapping playground there is a full example,


*<mapping>*
* <source>*
* <path>parentOrgRef</path>*
* </source>*
* <source>*
* <path>name</path>*
* </source>*
* <expression>*
* <script>*
* <code>*
* org1 = parentOrgRef != null ? midpoint.getOrgByOid(parentOrgRef?.oid) :
null*
* org2 = org1?.parentOrgRef ?
midpoint.getOrgByOid(org1?.parentOrgRef.get(0).oid) : null*
* org3 = org2?.parentOrgRef ?
midpoint.getOrgByOid(org2?.parentOrgRef.get(0).oid) : null*

* 'uid=' + name +*
* (org1 ? ',ou=' + org1?.name : '') +*
* (org2 ? ',ou=' + org2?.name : '') +*
* (org3 ? ',ou=' + org3?.name : '') + ',dc=example,dc=com'*
* </code>*
* </script>*
* </expression>*
* <target>*
* <path>description</path>*
* </target>*
*</mapping>*





On Wed, May 8, 2019 at 3:15 AM Vladislavs Filipciks <
vladislavs.filipciks at csolutions.lv> wrote:

> Hello.
>
> I have Organization Structure in MidPoint, so each new child created in
> tree will have assignment of parent Org.
> Is it possible to get data from parent Org attribute to use in mapping?
> Currently each Org has extension attribute adOUPath that refers to OU path
> in AD ( OU=Org1,OU=Org2,OU=Org3 etc.).
> When new child is created, I want to take parentOrg's adOUPath value and
> map it to child's attribute.
>
> What I already tried is:
>     <mapping>
>       <strength>weak</strength>
>       <name>Org OU path from assignment mapping</name>
>         <source>
>             <path>$focus/focusAssignment/extension/adOUPath</path>
>         </source>
>         <source>
>             <path>$focus/name</path>
>         </source>
>         <expression>
>         <script>
>           <code>
>             log.info("adOUPath is " + adOUPath);
>             if(adOUPath!=null){
>             newPath = "OU=" + name + "," + adOUPath;
>             return newPath;
>             }
>           </code>
>         </script>
>       </expression>
>       <target>
>         <path>$focus/extension/adOUPath</path>
>       </target>
>     </mapping>
>
> In part of
> <source>
>             <path>$focus/focusAssignment/extension/adOUPath</path>
> </source>
> I have tried different variables: assignment[0], immediateAssignment,
> immediateRole and all result in null
>
> Thanks in advance.
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20190508/67fcadcb/attachment.htm>


More information about the midPoint mailing list