[midPoint] Task to generate approval workflow with UserObject modification (validuntil)

Nico Pätzelt-Schäkel paetni1 at gmail.com
Fri Apr 28 13:34:05 CEST 2017


Hello,

at the moment i have a task which querys all activ users and gets the valid
until date. The task disables the user for testing purpose.
The task will be changed to run daily and only query users, which valid
until date is less then two weeks in the future.
How can i change the task to generate an approval workflow for each user
the query returns. This Workflow must be assignted to the user's manager.
If the workflow get's approved the user's valid until field should be set
to validuntil + 1 month.

This is the Task at the moment:
<name>Disable users</name>
   <extension xmlns:mext="
http://midpoint.evolveum.com/xml/ns/public/model/extension-3"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:type="c:ExtensionType">
      <mext:objectQuery>
          <q:filter>
            <q:and>
                <q:less>
                    <q:path>c:activation/validTo</q:path>
                    <expression>
                        <script>
                            <code>
                                import java.util.Date;
                                import java.util.GregorianCalendar;
                                import javax.xml.datatype.DatatypeFactory
                                import
javax.xml.datatype.XMLGregorianCalendar;
                                Date d = new Date();
                                GregorianCalendar gc = new
GregorianCalendar();
                                gc.setTime(d);
                                XMLGregorianCalendar xgc =
DatatypeFactory.newInstance().newXMLGregorianCalendar(gc);
                                return xgc
                            </code>
                        </script>
                    </expression>
                </q:less>
                <q:equal><!-- Only enabled users -->
                    <q:path>c:activation/administrativeStatus</q:path>
                    <q:value>enabled</q:value>
                </q:equal>
            </q:and>
        </q:filter>
      </mext:objectQuery>
      <mext:objectType>c:UserType</mext:objectType>
      <mext:objectDelta>
         <t:changeType>modify</t:changeType>
         <t:objectType>c:UserType</t:objectType>
         <t:oid>fakeOid</t:oid>
         <t:itemDelta>
            <t:modificationType>replace</t:modificationType>
            <t:path>c:activation/administrativeStatus</t:path>
            <t:value>
               disabled
            </t:value>
         </t:itemDelta>
      </mext:objectDelta>
   </extension>

Thanks for help
Nico Pätzelt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170428/b1cb1998/attachment.htm>


More information about the midPoint mailing list