[midPoint] extension/property mapping in user template

Pálos Gustáv gustav.palos at gmail.com
Thu Apr 9 06:10:01 CEST 2020


Hi Vladislavs,

is enought to put condition to your mapping

<condition>
    <script>
           <code> // run this template only in new value, old value ignore
                        boolean isNew =
com.evolveum.midpoint.model.common.expression.script.ScriptExpressionEvaluationContext.getThreadLocal().isEvaluateNew()

                        return isNew && !basic.isEmpty( adGroup )
            </code>
    </script>
</condition>

Best regards,

Gustav


st 8. 4. 2020 o 19:39 Vladislavs Filipciks <
vladislavs.filipciks at csolutions.lv> napísal(a):

> Hello. Ty for reply. Unfortunately, further in execution I receive
> exception, that mapping is not possible on null object adGroup.
> I've tried several ways, for example if I remove this mapping from
> template, then mapping in resource works fine on account import - user is
> being created, with appropriate account and property adGroup filled nicely.
> I don't get it, why template mapping isn't working. I got another similar
> in OU template and it works nicely.
>
> I'll try to remove this user template and extension completely and import
> them once again.
>
>
> 8 апр. 2020 г. 17:43 пользователь Pavol Mederly <mederly at evolveum.com>
> написал:
>
> Hello Vladislavs,
>
> just a quick try: your template mapping should be executed twice - once
> for "old" value of extension/adGroup and once for "new" value of it. So
> maybe what you see in the log is the first execution. Isn't there another
> execution, this time with the expected value?
>
> Best regards,
>
> Pavol Mederly
> Software developerevolveum.com
>
> On 08/04/2020 16:34, Vladislavs Filipciks wrote:
>
> Hello.
>
> I'm having trouble mapping user extended schema property to another
> extended schema property during user import from resource. The source
> extension/property is always being null while object template is processed.
> Probably I'm missing some additional config or something. Could any one
> suggest/correct me? Config snips:
>
> Resource:
> <attribute>
>                <ref>ri:memberOf</ref>
>                <inbound>
>                 <expression>
>                   <script>
>                      <code>
>                         if(input != null){
>                             tmpdn = input;
>
>                             groupPath = tmpdn.substring(0, tmpdn.indexOf(",DC="));
>
>                             log.info
> ("-- adGroup from resource schemaHandling " + groupPath );
>                             return groupPath;
>                         }
>                     </code>
>                   </script>
>                  </expression>
>                 <target>
>                     <path>extension/adGroup</path>
>                 </target>
>             </inbound>
>            </attribute>
>
> Extension schema:
>
> <xsd:complexType name="UserExtensionType">
>     <xsd:annotation>
>       <xsd:appinfo>
>         <a:extension ref="c:UserType"/>
>       </xsd:appinfo>
>     </xsd:annotation>
>     <xsd:sequence>
>
> User template that is being used with sync:
>
> <mapping>
>     <name>Ad Group name mapping</name>
>     <source>
>             <path>extension/adGroup</path>
>     </source>
>     <expression>
>         <script>
>             <code>
>                 log.info
> ('+++++++++++++++++ adGroup from user template ' + adGroup);
>                 if ((groupName = adGroup.split(",CN=")[0].substring(3))){
>                 return groupName.trim();
>                 }
>                 groupName = adGroup.split(",OU=")[0].substring(3);
>                 log.info
> ('++++++ gorupName from user template ' + groupName);
>                 return groupName.trim();
>             </code>
>         </script>
>     </expression>
>     <target>
>           <path>extension/groupName</path>
>     </target>
>    </mapping>
>
> Log:
>
> 2020-04-08 17:31:28,495 [MODEL] [http-nio-8080-exec-4] INFO
> (com.evolveum.midpoint.expression): -- adGroup from resource schemaHandling
> CN=Midpoint Test Group,OU=Midpoint Test OU,OU=CS_group_users
> 2020-04-08 17:31:28,496 [MODEL] [http-nio-8080-exec-4] INFO
> (com.evolveum.midpoint.expression): -- adGroup from resource schemaHandling
> CN=Domain Admins,CN=Users
> 2020-04-08 17:31:28,500 [MODEL] [http-nio-8080-exec-4] INFO
> (com.evolveum.midpoint.expression): -- adOUContainer from resource
> schemaHandling OU=Midpoint Test OU,OU=CS_group_users
> 2020-04-08 17:31:28,515 [MODEL] [http-nio-8080-exec-4] INFO
> (com.evolveum.midpoint.expression): +++++++++++++++++ adGroup from user
> template null
>
>
>
> *Vladislavs Fiļipčiks*
>
> +371 6784 7766
>
> *SIA “Corporate Solutions”*
>
> Pērnavas 43A-9, Rīga, LV-1009
>
> www.csolutions.lv
>
>
> Šis e-pasts un tā pielikumā esošie dokumenti var saturēt ierobežotas
> pieejamības informāciju, cita starpā fizisko personu datus, kas adresēta
> tikai tā saņēmējam un izmantojama tikai leģitīmiem mērķiem. Ja esat saņēmis
> šo e-pastu kļūdas dēļ, vai nav pamatota mērķa ierobežotas pieejamības
> informācijas, cita starpā fizisko personu datu, apstrādei, Jums nav tiesību
> izmantot vai pārsūtīt šajā e-pastā un tam pievienotajos dokumentos ietverto
> informāciju. Šādā gadījumā nekavējoties neatgriezeniski izdzēsiet šo
> e-pastu.
>
> _______________________________________________
> midPoint mailing listmidPoint at lists.evolveum.comhttps://lists.evolveum.com/mailman/listinfo/midpoint
>
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> https://lists.evolveum.com/mailman/listinfo/midpoint
>


-- 
s pozdravom

Gustáv Pálos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20200409/d2f1885f/attachment.htm>


More information about the midPoint mailing list