<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hello Nico,</p>
    <p>it should be possible to automatically approve the changes based
      on the current channel. The channel could be determined by calling<br>
    </p>
    <p><tt>midpoint.getCurrentTask().getChannel()</tt></p>
    <p>Please try to determine which value there is during the import
      and during the standard GUI operation. They should be different.</p>
    <p>Hope this helps.<br>
    </p>
    <pre class="moz-signature" cols="72">Pavol Mederly
Software developer
evolveum.com
</pre>
    <div class="moz-cite-prefix">On 28.11.2016 15:36, Nico
      Pätzelt-Schäkel wrote:<br>
    </div>
    <blockquote
cite="mid:CAGh9kZzAnwurYk9867j=G26hmjHrGoU4MDU_vKovL7fxZnvvZQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>Hello,<br>
            <br>
          </div>
          i am working on workflows and have a problem. My hook is
          assigning roles to users which get imported to the system. My
          metarole has an inducment with an approval schema like below.
          When i import a new user from a ressource everything seems OK.
          The approval schema gets approved automatically because a
          superuser requested the import and then a task is created
          automatically by the hook to assign the correct roles. This
          tasks fails with an error "An exception occurred within model
          operation, in task Task(id:1480338905821-0-1, name:Approving
          and executing creation of <username>"...<br>
          Object of type 'UserType' with oid '57776a53-8ff2-4715-acb8-<wbr>a2f89da7dc28'
          was not found.<a moz-do-not-send="true"
            class="m_722040331000202663gmail-box-title"
            id="m_722040331000202663gmail-id6071"> </a><br>
        </div>
        Is it possible to disable the approval schema for importing
        users? Or disableing the approval process for all things done by
        the hook? Without the approval schema in the metarole the hook
        works well. <br>
        <div>
          <div>
            <div><br>
              <inducement><br>
                       <focusMappings><br>
                           <mapping><br>
                               <strength>strong</strength><br>
                               <expression><br>
                                   <value><br>
                                       <name>Approval
              Schema</name><br>
                                       <description>Alle Anfragen
              müssen vom Admin genehmigt werden</description><br>
                                              <level><br>
                                                      <name>IDM
              ADMIN</name>                                <br>
                                                      <approverRef
              oid="00000000-0000-0000-0000-0<wbr>00000000002"
              type="c:UserType"><br>
                                                        
               <description>superuser</descr<wbr>iption><br>
                                                    
               </approverRef><br>
                                                    
               <automaticallyApproved><br>
                                                    
               <description>If the user has Superuser assignment,
              this role is automatically approved for
              him.</description><br>
                                                  <br>
                                                          <script><br>
                                                            
               <code><br>
                                                                  import
              com.evolveum.midpoint.prism.*;<br>
                                                                  import
              <a moz-do-not-send="true"
                href="http://com.evolveum.midpoint.prism.pa">com.evolveum.midpoint.prism.pa</a><wbr>th.*;<br>
                                                                  import
              com.evolveum.midpoint.xml.ns._<wbr>public.common.common_3.*;<br>
                                                                
               midpoint.isDirectlyAssigned(r<wbr>equester,
              midpoint.searchObjectByName(Ro<wbr>leType, "Superuser"))<br>
                                                            
               </code><br>
                                                        
               </script><br>
                                                    
               </automaticallyApproved><br>
                                              </level><br>
                                   </value><br>
                               </expression><br>
                               <target><br>
                                
               <path>approvalSchema</path><br>
                               </target><br>
                           </mapping><br>
                       </focusMappings> <br>
              </inducement><br>
              <br>
            </div>
            <div>Nico <br>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
midPoint mailing list
<a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<a class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>