[midPoint] Object Sync condition - check user's existence
Pálos Gustáv
gustav.palos at evolveum.com
Mon Oct 24 19:32:08 CEST 2016
Hi Ana,
I'm using for similar use case this condition in objectSynchronization:
<condition>
<script>
<code>
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;
import com.evolveum.midpoint.prism.query.builder.QueryBuilder;
import com.evolveum.midpoint.prism.path.ItemPath;
STATUSS = basic.getAttributeValue(shadow, 'STATUSS')
toImport = STATUSS == '01'
// find user in MP, if exists syncronize it also
log.info('shadow {}',
shadow.asPrismObject().debugDump())
activation = shadow.getActivation()
shadowUid = basic.getIdentifierValue(shadow);
userInMPQuery = QueryBuilder.queryFor(UserType.class,
midpoint.getPrismContext()).item(UserType.F_EMPLOYEE_NUMBER).eq(shadowUid).and().item(UserType.F_EMPLOYEE_TYPE).eq("pavs").build()
userInMP = midpoint.searchObjects(UserType, userInMPQuery);
isInMP = userInMP?.size()>0 ? true : false;
log.info('isInMP: '+isInMP);
toImport = isInMP || toImport;
return toImport;
</code>
</script>
</condition>
In my case I need to have status=='01' (enabled), or already imported
(variable isInMP)
Gustav
2016-10-24 19:21 GMT+02:00 Ana Pereyra <apereyra at identicum.com>:
> Hi everybody.
>
> I have the following issue: I need to import users from two different
> database table resources. The problem is that I don't want to create in
> mipoint every user in the tables, I will create a user in midpoint only if
> the database field value that sets the validTo date attribute is lower than
> the current date.
>
> But that's for the creation only, if the user already exists in midpoint,
> I want to link the account to that user, no matter if the validTo date is
> lower than the current date or not (because maybe I have to update the
> validTo date to disable the user).
>
> I think I'll need some way to check if the user already exists in the
> synchronization/objectSynchronization/condition. Can anyone help me with
> this? Is this possible?
> Thank you very much.
>
> Regards
>
> --
> *Ana Pereyra*
> Identicum S.A.
>
> *Jorge Newbery 3226, ArgentinaTel: +54 (11) **4552.3050*
> *apereyra at identicum.com <apereyra at identicum.com>*
> www.identicum.com
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint
>
>
--
Gustáv Pálos
Identity Engineer
evolveum.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20161024/8e4300fa/attachment.htm>
More information about the midPoint
mailing list