[midPoint] Skip approvelSchema when importing objects

Pavol Mederly mederly at evolveum.com
Thu Dec 8 19:41:44 CET 2016


Hello Nico,

I've tried that myself today. You're right - there's no channel there. 
It was due to a bug in midPoint, which I've fixed on master branch 
(https://github.com/Evolveum/midpoint/commit/39581c451f2e06a8cc19932310f41cc0b3da5cba). 
If you want to use it for 3.4.x, please cherry-pick it to 3.4-support 
branch and build + test the WAR file.

However. I verified that when initiating the operation from GUI, the 
channel is really 
/http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user/. When 
doing import from resource, I haven't used a custom hook (as you did), 
but much simpler approach: specific user template:

In the resource definition:

             <reaction>
<situation>unmatched</situation>
                <objectTemplateRef 
oid="7ee3c422-c66a-4725-bb9e-12d5f85ecf6b" type="c:ObjectTemplateType"/>
                <action>
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#addUser</handlerUri>
                </action>
             </reaction>

The template looks like this:

<objectTemplate oid="7ee3c422-c66a-4725-bb9e-12d5f85ecf6b" 
xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3">
     <name>Custom User Template</name>
     <mapping>
         <expression>
             <value>
                  <targetRef oid="7d8cb641-d247-4b1a-bd73-12db459b7627" 
type="RoleType"/>    <!-- role with the auto approval ... -->
             </value>
         </expression>
         <target>
             <path>assignment</path>
         </target>
     </mapping>
</objectTemplate>

But what's important is that when the user was added via "Import from 
resource", the workflow hook was /not/ involved at all. The operation 
that was executed was a part of the /secondary delta/ - meaning the 
delta that was "induced" by another change. In this particular 
situation, the cause was the existence of resource object that was 
imported. And workflows react only to primary deltas.

What does your custom hook do? Does it modify primary delta? If yes, you 
could maybe change it to work with the secondary delta: that would be 
cleaner. And, if your hook does only the assignment of a role, it would 
be best to replace it by using standard midPoint mechanism for this - 
and this is object template.

Best regards,

Pavol Mederly
Software developer
evolveum.com

On 08.12.2016 10:43, Nico Pätzelt-Schäkel wrote:
> Hello Pavol Mederly,
> thanks for the answer. I have checked the output from :
> midpoint.getCurrentTask().getChannel()
> In both cases (import account as Superuser and request a role via GUI) the output of getChannel is "null".
> I checked the output from midpoint.getCurrentTask() which gives me something like  Task(id:1481189325403-0-1, name:null, oid:null).
> If I search the task ID in the server tasks GUI. There is no task or subtask with this taskid.
> Have you any idea why this is the case?
> Kind regards
> Nico
>
>
> _______________________________________________
> 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/20161208/e5ad92f6/attachment.htm>


More information about the midPoint mailing list