[midPoint] - Search filter with scripted expression

Pavol Mederly mederly at evolveum.com
Mon Aug 22 22:36:23 CEST 2016


Hello Rodrigo,

your bulk action seems to be quite correct, provided you have declared 
all your namespaces (c, q). I don't know the context, i.e. if you 
copy-and-pasted the script code from a task object, or entered it via 
GUI ("Bulk actions"). it would be also helpful if you would paste more 
details, i.e. the actual stack trace of the SchemaException; or at least 
the inner exception. It describes the reason of the problem.

I'd like to say that:

 1. Even after fixing the schema exception, the problem is that bulk
    actions (and the "search" bulk action in particular) do not
    currently support expressions in filters. I.e. only constant values
    are allowed. I have created a jira for it (MID-3364
    <https://jira.evolveum.com/browse/MID-3364>). It is not too much
    work to implement, but we are very busy these days/weeks; so I
    marked it as "sposoring needed". You could contact Igor or Radovan
    for more information on this.
 2. There are some workarounds possible, however. For example, a task
    can be created and started via SOAP or REST. Or even a specific bulk
    action can be executed via SOAP. So you could run your actions (with
    pre-calculated "current date" value) regularly from outside
    midPoint. (Not very clean, but possible.)
 3. But the most important of all: midPoint has a native mechanism for
    disabling users (as well as roles, orgs, or assignments) after given
    period of time: activation. Instead of using extension/metaEndDate,
    you could use activation/validTo, and your users will be disabled
    automatically. Please see wiki article on activation
    <https://wiki.evolveum.com/display/midPoint/Activation> for more
    information.

Best regards,

Pavol Mederly
Software developer
evolveum.com

On 22.08.2016 21:00, Rodrigo Yanis wrote:
> Hello everyone,
>
> I'm currently trying to build a task to disable users when they reach 
> their termination date in midPoint (expressed on a custom attribute as 
> dd/MM/yyyy).
>
> I'm having difficulties defining a search filter that would evaluate 
> equality to a value returned by a Groovy script, the code is the 
> following:
>
> <scext:executeScript 
> xmlns:scext="http://midpoint.evolveum.com/xml/ns/public/model/scripting/extension-3">
>                 <s:search 
> xmlns:s="http://midpoint.evolveum.com/xml/ns/public/model/scripting-3">
> <s:type>c:UserType</s:type>
>                     <s:searchFilter>
>                         <q:equal>
> <q:path>extension/metaEndDate</q:path>
>                             <c:expression>
>                                 <c:script>
>                                     <c:code>
>                                         def dateTime = new 
> Date().format( 'dd/MM/yyyy' );
>                                         return dateTime.toString();
>                                     </c:code>
>                                 </c:script>
>                             </c:expression>
>                         </q:equal>
>                     </s:searchFilter>
>                     <s:action>
> <s:type>disable</s:type>
>                     </s:action>
>                 </s:search>
>             </scext:executeScript>
>
> Error (execution time) I recieve is the following: Couldn't execute 
> script: Couldn't parse object filter due to schema exception
>
> I understand this must be related to namespaces definitions. I 
> couldn't find any example of what i'm trying to do either.
>
> Do you know if this is possible?
>
> Thanks.
>
> *Rodrigo Yanis.*
> Identicum S.A.
> Jorge Newbery 3226
> Tel: +54 (11) 4824-9971
> ryanis at identicum.com <mailto:ryanis at identicum.com>
> www.identicum.com <http://www.identicum.com/>
>
>
> _______________________________________________
> 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/20160822/dae0e11a/attachment.htm>


More information about the midPoint mailing list