[midPoint] User template - rename user
Ivan Noris
ivan.noris at evolveum.com
Wed Aug 31 16:56:49 CEST 2016
Hi Mariano,
I'm not sure if I understand.
Does the logic work as supposed for both scenarios, when doing import,
for creating the users for the very first time?
What exact scenario does not work for you?
I can see the mapping in the object template for "name" attribute is
weak. So if the name already has value, it will not be overwritten.
I also could suggest that you do the logic for choosing which attribute
to use for setting user/name in the inbound mapping by using something
like this:
<attribute>
<ref>ri:id</ref> <!-- this is the attribute which always has value) -->
<inbound>
<source>
<path>$account/attributes/email</path> <!-- source: the email attribute -->
</source>
<expression>
<script>
<code>
if (basic.isEmpty(email)) return input // input is ri:id here
else return email
</code>
</script>
</expression>
<target>
<path>$user/name</path>
</target>
</inbound>
</attribute>
I have not tried this recently, but it could work.
You can still have other mappings, e.g. one to copy the email to
$user/emailAddress etc.
The question is how you will have set the correlation rules then...
Regards,
Ivan
On 08/30/2016 08:49 PM, mariano marron wrote:
> Hi everyone, I have the following issue: I need to import users from a
> database table (I'm using the database resource) but first I need to
> see if the user in the table has the field "email" not null, and if it
> does, that's the name I want for my user in midpoint. If it doesn't, I
> user another field of the table (id number). I have configured the
> resource inbound mapping to map the id number to the name first and I
> was trying to set the email if not null with an object template, using
> the following mapping:
>
> <mapping>
> <strength>weak</strength>
> <source>
> <name>email</name>
> <c:path>$user/emailAddress</c:path>
> </source>
> <expression>
> <script>
>
> <language>http://midpoint.evolveum.com/xml/ns/public/expression/language#Groovy</language>
> <code>
> return email.split("@")[0]
> </code>
> </script>
> </expression>
> <target>
> <c:path>name</c:path>
> </target>
> <condition>
> <script>
> <code>
> email != null
> </code>
> </script>
> </condition>
> </mapping>
>
> This isn't working. Any ideas why? The resource is referenced to the
> template and it's executing it when I import users (I see some other
> logic applied to the user that is created in midpoint), but not
> renaming them. Thanks in advance.
>
> Mariano
>
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint
--
Ivan Noris
Senior Identity Engineer
evolveum.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20160831/07735c28/attachment.htm>
More information about the midPoint
mailing list