<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hello Chris, Arnošt, <br>
    </p>
    <p>
      <blockquote type="cite">I don't believe there is other way to do
        this right now, but please anybody proove me wrong.</blockquote>
      <b>Arnošt:</b> You are absolutely right, as far as the current
      status of midPoint is concerned.</p>
    <p>User assignments are updated only when users are (re)computed. So
      there's no way how to do this as part of processing of the
      service.</p>
    <p>The model hook is a way to go, as you suggested. (<a
        moz-do-not-send="true"
        href="https://wiki.evolveum.com/display/midPoint/Scripting+Hooks">https://wiki.evolveum.com/display/midPoint/Scripting+Hooks</a>)</p>
    <p><b>Chris:</b> you can choose between directly recomputing the
      old/new holders, or just creating a trigger on these user objects,
      to be recomputed by the Trigger scanner task. The latter option is
      useful if you want to Service operation finish quickly (e.g. if
      the user operations take a longer time because of resources
      involved).</p>
    <p>You can even try to use <a moz-do-not-send="true"
        href="https://wiki.evolveum.com/display/midPoint/Policy+Rules">https://wiki.evolveum.com/display/midPoint/Policy+Rules</a>:
      something like "if extension/rsBadgeAssignee changes, execute
      specified bulk action". (But I am not quite sure about the exact
      configuration.)</p>
    <p>Nevertheless, if you'd need any help, just let us know.</p>
    <p>Best regards,<br>
    </p>
    <pre class="moz-signature" cols="72">Pavol Mederly
Software developer
evolveum.com
</pre>
    <div class="moz-cite-prefix">On 16.09.2019 10:13, Arnošt Starosta -
      AMI Praha a.s. wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAGPA3FLimDKCGBYv28BLb12V3E+ASBtet3w49j6pp3g6N46Q1A@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hi Chris,
        <div><br>
        </div>
        <div>you can intercept the extension/rsBadgeAssignee change in a
          hook and based on it's old and new values find the two
          employees and explicitly recompute just them. With your
          assignment in user template this will do the job. I would try
          a final hook for the service type.</div>
        <div><br>
        </div>
        <div>And as the recompute may fail, you want to make sure to
          recompute the failed users in the future - either recompute
          all of them once in a while or run a specialized task to find
          badges assigned to wrong employees etc.</div>
        <div><br>
        </div>
        <div>I don't believe there is other way to do this right now,
          but please anybody proove me wrong.</div>
        <div><br>
        </div>
        <div>The autoassignment wont help you, the users must still be
          recomputed and it comes with a performace price on top. But
          when i need to access the attributes of both roles and focus
          objects in assignments, i use the assignmentPath and related
          variables, see midpoint wiki.</div>
        <div><br>
        </div>
        <div>arnost</div>
        <br>
        <div class="gmail_quote">
          <div dir="ltr" class="gmail_attr">so 14. 9. 2019 v 11:02
            odesílatel Chris Woods <<a
              href="mailto:Chris.Woods@rohde-schwarz.com"
              target="_blank" moz-do-not-send="true">Chris.Woods@rohde-schwarz.com</a>>
            napsal:<br>
          </div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">
            <div lang="DE">
              <div
class="m_-7117259782126524313m_-7698814065786528674gmail-m_-2630579181631049824WordSection1">
                <p class="MsoNormal"><span lang="EN-US">Hi everyone,</span></p>
                <p class="MsoNormal"><span lang="EN-US">I’m probably
                    thinking about this completely the wrong way, but
                    here goes anyway:</span></p>
                <p class="MsoNormal"><span lang="EN-US">I have a company
                    ID card system that we originally had setup so that
                    when reconciling, the badge would appear as  a
                    projection for the user (when the employeeID for the
                    badge matched the $focus/name of the user). However,
                    we now have a requirement to store more data about
                    the badge than the id card system provides, so I
                    modified the synchronisation setup to create a
                    FocusType of Service. This service is assigned an
                    archetype “Company ID card”.</span></p>
                <p class="MsoNormal"><span lang="EN-US">All is working
                    well – A service for each card in the card database
                    was created with the appropriate archetype.
                  </span></p>
                <p class="MsoNormal"><span lang="EN-US">However, I can’t
                    seem to find a way to automatically assign the
                    service to the user based on the employeeID which is
                    now stored in the service as
                    extension/rsBadgeAssignee.</span></p>
                <p class="MsoNormal"><span lang="EN-US">I tried to do
                    the assignment in the User object template, which
                    worked – as long as I actually opened the user and
                    recomputed them. Day cards are transferred from
                    person to person, so I don’t want to have to update
                    14,000 Users, just because one card has transferred
                    ownership. If I just modified the rsBadgeAssignee in
                    the card service object, nothing happened to either
                    the previous owner (removal) or the new owner
                    (assignment).</span></p>
                <p class="MsoNormal"><span lang="EN-US">I then tried
                    autoassign in the archetype. All the examples for
                    autoassignment use some kind of constant like
                    ‘internal’ or ‘FTE’ to be present in the focal
                    object (user). What I couldn’t work out how to do
                    was something like this:</span></p>
                <p class="MsoNormal"
                  style="margin-bottom:0.0001pt;line-height:normal">
                  <span style="font-family:Consolas;color:teal"
                    lang="EN-US"><</span><span
style="font-family:Consolas;color:rgb(63,127,127);background:rgb(212,212,212)"
                    lang="EN-US">autoassign</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US">></span><span
                    style="font-family:Consolas;color:black"
                    lang="EN-US">              </span><span
                    style="font-family:Consolas" lang="EN-US"></span></p>
                <p class="MsoNormal"
                  style="margin-bottom:0.0001pt;line-height:normal">
                  <span style="font-family:Consolas;color:black"
                    lang="EN-US">        </span><span
                    style="font-family:Consolas;color:teal" lang="EN-US"><</span><span
                    style="font-family:Consolas;color:rgb(63,127,127)"
                    lang="EN-US">enabled</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US">></span><span
                    style="font-family:Consolas;color:black"
                    lang="EN-US">true</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US"></</span><span
                    style="font-family:Consolas;color:rgb(63,127,127)"
                    lang="EN-US">enabled</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US">></span><span
                    style="font-family:Consolas" lang="EN-US"></span></p>
                <p class="MsoNormal"
                  style="margin-bottom:0.0001pt;line-height:normal">
                  <span style="font-family:Consolas;color:black"
                    lang="EN-US">        </span><span
                    style="font-family:Consolas;color:teal" lang="EN-US"><</span><span
                    style="font-family:Consolas;color:rgb(63,127,127)"
                    lang="EN-US">focus</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US">></span><span
                    style="font-family:Consolas" lang="EN-US"></span></p>
                <p class="MsoNormal"
                  style="margin-bottom:0.0001pt;line-height:normal">
                  <span style="font-family:Consolas;color:black"
                    lang="EN-US">            </span><span
                    style="font-family:Consolas;color:teal" lang="EN-US"><</span><span
                    style="font-family:Consolas;color:rgb(63,127,127)"
                    lang="EN-US">mapping</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US">></span><span
                    style="font-family:Consolas" lang="EN-US"></span></p>
                <p class="MsoNormal"
                  style="margin-bottom:0.0001pt;line-height:normal">
                  <span style="font-family:Consolas;color:black"
                    lang="EN-US">               </span>
                  <span style="font-family:Consolas;color:teal"
                    lang="EN-US"><</span><span
                    style="font-family:Consolas;color:rgb(63,127,127)"
                    lang="EN-US">name</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US">></span><span
                    style="font-family:Consolas;color:black"
                    lang="EN-US">Badge autoassign</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US"></</span><span
                    style="font-family:Consolas;color:rgb(63,127,127)"
                    lang="EN-US">name</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US">></span><span
                    style="font-family:Consolas" lang="EN-US"></span></p>
                <p class="MsoNormal"
                  style="margin-bottom:0.0001pt;line-height:normal">
                  <span style="font-family:Consolas;color:black"
                    lang="EN-US">               </span>
                  <span style="font-family:Consolas;color:teal"
                    lang="EN-US"><</span><span
                    style="font-family:Consolas;color:rgb(63,127,127)"
                    lang="EN-US">strength</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US">></span><span
                    style="font-family:Consolas;color:black"
                    lang="EN-US">strong</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US"></</span><span
                    style="font-family:Consolas;color:rgb(63,127,127)"
                    lang="EN-US">strength</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US">></span><span
                    style="font-family:Consolas" lang="EN-US"></span></p>
                <p class="MsoNormal"
                  style="margin-bottom:0.0001pt;line-height:normal">
                  <span style="font-family:Consolas;color:black"
                    lang="EN-US">               </span>
                  <span style="font-family:Consolas;color:teal"
                    lang="EN-US"><</span><span
                    style="font-family:Consolas;color:rgb(63,127,127)"
                    lang="EN-US">source</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US">></span><span
                    style="font-family:Consolas" lang="EN-US"></span></p>
                <p class="MsoNormal"
                  style="margin-bottom:0.0001pt;line-height:normal">
                  <span style="font-family:Consolas;color:black"
                    lang="EN-US">                    </span>
                  <span style="font-family:Consolas;color:teal"
                    lang="EN-US"><</span><span
                    style="font-family:Consolas;color:rgb(63,127,127)"
                    lang="EN-US">path</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US">></span><span
                    style="font-family:Consolas;color:black"
                    lang="EN-US">$focus/name</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US"></</span><span
                    style="font-family:Consolas;color:rgb(63,127,127)"
                    lang="EN-US">path</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US">>
                    <-- the employeeID of the user --> </span><span
                    style="font-family:Consolas" lang="EN-US"></span></p>
                <p class="MsoNormal"
                  style="margin-bottom:0.0001pt;line-height:normal">
                  <span style="font-family:Consolas;color:black"
                    lang="EN-US">                </span><span
                    style="font-family:Consolas;color:teal" lang="EN-US"></</span><span
                    style="font-family:Consolas;color:rgb(63,127,127)"
                    lang="EN-US">source</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US">></span><span
                    style="font-family:Consolas;color:black"
                    lang="EN-US">   
                  </span><span style="font-family:Consolas" lang="EN-US"></span></p>
                <p class="MsoNormal"
                  style="margin-bottom:0.0001pt;line-height:normal">
                  <span style="font-family:Consolas;color:black"
                    lang="EN-US">                </span><span
                    style="font-family:Consolas;color:teal" lang="EN-US"><</span><span
                    style="font-family:Consolas;color:rgb(63,127,127)"
                    lang="EN-US">source</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US">></span><span
                    style="font-family:Consolas" lang="EN-US"></span></p>
                <p class="MsoNormal"
                  style="margin-bottom:0.0001pt;line-height:normal">
                  <span style="font-family:Consolas;color:black"
                    lang="EN-US">                   </span>
                  <span style="font-family:Consolas;color:teal"
                    lang="EN-US"><</span><span
                    style="font-family:Consolas;color:rgb(63,127,127)"
                    lang="EN-US">path</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US">></span><span
                    style="font-family:Consolas;color:black"
                    lang="EN-US">$this/extension/rsBadgeAssignee</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US"></</span><span
                    style="font-family:Consolas;color:rgb(63,127,127)"
                    lang="EN-US">path</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US">>   
                    <-- trying to reference rsBadgeAssignee in
                    service itself –-></span><span
                    style="font-family:Consolas" lang="EN-US"></span></p>
                <p class="MsoNormal"
                  style="margin-bottom:0.0001pt;line-height:normal">
                  <span style="font-family:Consolas;color:black"
                    lang="EN-US">                </span>
                  <span style="font-family:Consolas;color:teal"
                    lang="EN-US"></</span><span
                    style="font-family:Consolas;color:rgb(63,127,127)"
                    lang="EN-US">source</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US">></span><span
                    style="font-family:Consolas;color:black"
                    lang="EN-US">          
                  </span><span style="font-family:Consolas" lang="EN-US"></span></p>
                <p class="MsoNormal"
                  style="margin-bottom:0.0001pt;line-height:normal">
                  <span style="font-family:Consolas;color:black"
                    lang="EN-US">                </span><span
                    style="font-family:Consolas;color:teal" lang="EN-US"><</span><span
                    style="font-family:Consolas;color:rgb(63,127,127)"
                    lang="EN-US">condition</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US">></span><span
                    style="font-family:Consolas" lang="EN-US"></span></p>
                <p class="MsoNormal"
                  style="margin-bottom:0.0001pt;line-height:normal">
                  <span style="font-family:Consolas;color:black"
                    lang="EN-US">                    </span>
                  <span style="font-family:Consolas;color:teal"
                    lang="EN-US"><</span><span
                    style="font-family:Consolas;color:rgb(63,127,127)"
                    lang="EN-US">script</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US">></span><span
                    style="font-family:Consolas" lang="EN-US"></span></p>
                <p class="MsoNormal"
                  style="margin-bottom:0.0001pt;line-height:normal">
                  <span style="font-family:Consolas;color:black"
                    lang="EN-US">                       
                  </span><span style="font-family:Consolas;color:teal"
                    lang="EN-US"><</span><span
                    style="font-family:Consolas;color:rgb(63,127,127)"
                    lang="EN-US">code</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US">></span><span
                    style="font-family:Consolas;color:black"
                    lang="EN-US">basic.stringify(name).equals(rsBadgeAssignee)</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US"></</span><span
                    style="font-family:Consolas;color:rgb(63,127,127)"
                    lang="EN-US">code</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US">></span><span
                    style="font-family:Consolas" lang="EN-US"></span></p>
                <p class="MsoNormal"
                  style="margin-bottom:0.0001pt;line-height:normal">
                  <span style="font-family:Consolas;color:black"
                    lang="EN-US">                    </span>
                  <span style="font-family:Consolas;color:teal"></</span><span
                    style="font-family:Consolas;color:rgb(63,127,127)">script</span><span
                    style="font-family:Consolas;color:teal">></span><span
                    style="font-family:Consolas"></span></p>
                <p class="MsoNormal"
                  style="margin-bottom:0.0001pt;line-height:normal">
                  <span style="font-family:Consolas;color:black">               
                  </span><span style="font-family:Consolas;color:teal"></</span><span
                    style="font-family:Consolas;color:rgb(63,127,127)">condition</span><span
                    style="font-family:Consolas;color:teal">></span><span
                    style="font-family:Consolas"></span></p>
                <p class="MsoNormal"
                  style="margin-bottom:0.0001pt;line-height:normal">
                  <span style="font-family:Consolas;color:black">           
                  </span><span style="font-family:Consolas;color:teal"></</span><span
                    style="font-family:Consolas;color:rgb(63,127,127)">mapping</span><span
                    style="font-family:Consolas;color:teal">></span><span
                    style="font-family:Consolas"></span></p>
                <p class="MsoNormal"
                  style="margin-bottom:0.0001pt;line-height:normal">
                  <span style="font-family:Consolas;color:black">       
                  </span><span style="font-family:Consolas;color:teal"></</span><span
                    style="font-family:Consolas;color:rgb(63,127,127)">focus</span><span
                    style="font-family:Consolas;color:teal">></span><span
                    style="font-family:Consolas"></span></p>
                <p class="MsoNormal"><span
                    style="font-family:Consolas;color:black">    </span><span
                    style="font-family:Consolas;color:teal"></</span><span
style="font-family:Consolas;color:rgb(63,127,127);background:rgb(212,212,212)">autoassign</span><span
                    style="font-family:Consolas;color:teal">></span></p>
                <p class="MsoNormal"><span lang="EN-US">This throws an
                    error, because there is no rsBadgeAsignee attribute
                    in the focus (User), but how do I reference “this”
                    (i.e. the service itself) in the condition?</span></p>
                <p class="MsoNormal"><span lang="EN-US">I hope all this
                    was not too confusing and appreciate any help!</span></p>
                <p class="MsoNormal"><span lang="EN-US"> </span></p>
                <p class="MsoNormal"><span lang="EN-US">Regards,</span></p>
                <p class="MsoNormal"><span lang="EN-US">Chris</span><span
                    style="font-family:Consolas;color:teal" lang="EN-US"></span></p>
                <p class="MsoNormal"><span lang="EN-US"> </span></p>
                <p class="MsoNormal"><span lang="EN-US"> </span></p>
                <p class="MsoNormal"><span lang="EN-US"> </span></p>
              </div>
            </div>
            _______________________________________________<br>
            midPoint mailing list<br>
            <a href="mailto:midPoint@lists.evolveum.com" target="_blank"
              moz-do-not-send="true">midPoint@lists.evolveum.com</a><br>
            <a
              href="http://lists.evolveum.com/mailman/listinfo/midpoint"
              rel="noreferrer" target="_blank" moz-do-not-send="true">http://lists.evolveum.com/mailman/listinfo/midpoint</a><br>
          </blockquote>
        </div>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        <div dir="ltr"
          class="m_-7117259782126524313m_-7698814065786528674gmail_signature">
          <div dir="ltr">
            <div>
              <div dir="ltr">
                <div
                  style="color:rgb(0,0,0);font-family:Arial,sans-serif;font-size:13px">
                  <p><strong>Arnošt Starosta</strong><br>
                    <span style="font-size:11px;color:rgb(128,128,128)">solution
                      architect</span></p>
                </div>
                <p
                  style="color:rgb(0,0,0);font-family:Arial,sans-serif;font-size:11px">gsm:
                  [+420] 603 794 932<br>
                  e‑mail: <a href="mailto:arnost.starosta@ami.cz"
                    target="_blank" moz-do-not-send="true">arnost.starosta@ami.cz</a></p>
                <p
                  style="color:rgb(0,0,0);font-family:Arial,sans-serif;font-size:11px"><strong>AMI
                    Praha a.s.</strong><br>
                  Pláničkova 11, 162 00 Praha 6</p>
                <p
                  style="color:rgb(0,0,0);font-family:Arial,sans-serif;font-size:11px">tel.:
                  [+420] 274 783 239 | web: <a href="https://www.ami.cz"
                    target="_blank" moz-do-not-send="true">www.ami.cz</a></p>
                <p
style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:10px;margin-top:20px"><img
                    src="http://www.ami.cz/images/podpis/ami_logo.gif"
                    alt="AMI Praha a.s." style="border:0px"
                    moz-do-not-send="true"></p>
                <p
style="font-family:Arial,sans-serif;font-size:11px;color:rgb(170,170,170)">Textem
                  tohoto e‑mailu podepisující neslibuje uzavřít
                  ani neuzavírá za společnost AMI Praha a.s.<br>
                  jakoukoliv smlouvu. Každá smlouva, pokud bude
                  uzavřena, musí mít výhradně písemnou formu.<br>
                  <span style="font-size:6px"> </span><br>
                  Tento e‑mail je určen výhradně pro potřeby
                  jeho adresáta/ů a může obsahovat důvěrné nebo osobní<br>
                  informace. Nejste‑li zamýšleným příjemcem, je zakázáno
                  jakékoliv zveřejňování, zprostředkování<br>
                  nebo jiné použití těchto informací. Pokud jste
                  obdrželi e‑mail neoprávněně, informujte o tom prosím<br>
                  odesílatele a vymažte neprodleně všechny kopie tohoto
                  e‑mailu včetně všech jeho příloh. Nakládáním<br>
                  s neoprávněně získanými informacemi se vystavujete
                  riziku právního postihu.</p>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-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>
  </body>
</html>