[midPoint] search using midpoint script library

Paul Heaney lists at pheaney.co.uk
Fri Mar 13 10:15:01 CET 2015


Hi Pavol,

Many thanks that looks ideal.  We'll give it a go shortly

The scenario we have is we have a customer with multiple active 
directories and looking to synchronise to a single directory we've got 
midPoint to sync basic attributes such as names etc synchronising to 
midPoint and out again to the target directory, we also need to 
synchronise DN attributes especially assistant and manager so we need to 
maintain that link between users into the target directory.

I was wondering if we could use associations in midPoint 3 to do this?

Cheers
Paul

On 12/03/15 20:14, Pavol Mederly wrote:
> Hello Paul,
>
> yes, midpoint.searchObjects can be used to implement that.
>
> An example that I was able to create is this:
>
> <expression>
>     <script>
>         <code>
> import com.evolveum.midpoint.prism.query.EqualFilter
> import com.evolveum.midpoint.prism.query.ObjectQuery
> import javax.xml.namespace.QName
> import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType
>
> prismContext = 
> midpoint.createEmptyObject(UserType.class).asPrismObject().getPrismContext() 
> // temporary solution until there's a midpoint.getPrismContext() method
>
> log.info("Trying to find a user with a nickname = {}", input)
> filter = EqualFilter.createEqual(new QName("nickName"), 
> UserType.class, prismContext, null, input)
> query = ObjectQuery.createObjectQuery(filter)
> list = midpoint.searchObjects(UserType.class, query)
> if (list.size() > 0) {
>     'Found: ' + list.get(0).getFamilyName()
> } else {
>     'Nothing found'
> }
>         </code>
>     </script>
> </expression>
>
> (Yes, I know it's a bit ugly. :-) Maybe someone could find a nicer 
> solution.)
>
> This specific script is used as an inbound expression for an 
> attribute. It tries to find a user with a nickName (chosen as an 
> example) equals to the value of the attribute.
> And then it uses a user's familyName attribute to construct the return 
> value.
>
> I suppose we don't have anything like this in our examples because it 
> is quite a non-usual thing - to search midPoint repository from within 
> a mapping. Other aspects aside, I think it would be quite slow to 
> execute. Maybe there would be some other way how to achieve what you'd 
> like to do.
>
> What exactly is your scenario, your requirement?
>
> Best regards,
> Pavol
>
>
> On 12. 3. 2015 18:25, Paul Heaney wrote:
>> Hi,
>>
>> We're looking to synchronise users assistants from Active Directory 
>> to midPoint, to do this we need to do a search on midPoint based on 
>> the received assistant value.  I believe we should be able to do this 
>> with the searchObjects function within the midPoint script library 
>> (using Groovy) though unfortunatly I'm having a few difficulties 
>> getting the syntax of the query parameter correct in my groovy script.
>>
>> I've had a look at the samples and also the test scripts though don't 
>> seem to be able to find an example, does anyone have an example or 
>> pointers on this call?
>>
>> Thanks
>> Paul
>> _______________________________________________
>> midPoint mailing list
>> midPoint at lists.evolveum.com
>> http://lists.evolveum.com/mailman/listinfo/midpoint
>
>
>
> _______________________________________________
> 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/20150313/cadc2e2c/attachment.htm>


More information about the midPoint mailing list