<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Hi,<br>
      <br>
      Yes. There are many options.<br>
      <br>
      The simplest is to use "legalize" feature. If set to true then the
      illegal resource objects (e.g. accounts) will be made legal.
      Illegal resource object is a linked resource object for which
      there is no assignment. If this option is set to true then it will
      automatically add a (direct) assignment for this object.<br>
      <br>
      See ProjectionPolicyType in common-3.xsd.<br>
      <br>
      This will add direct assignment with a construction (not a role).
      <br>
      <br>
      If you want to add a role then the best way is to use user
      template, mapping for assignment property and a proper condition.
      There are sctript functions that you can use to determine is the
      link exists, (e.g. midpoint.hasLinkedAccount(...)) and whether
      assignment exists (e.g. midpoint.isDirectlyAssigned(...)). You
      might also use the isLegal propert of LensElementContext ... but I
      don't think anyone tried this. In this case please take care to
      set your user template mapping to evaluationPhase=afterAssignments
      as the user template is normally evaluated before assignments and
      the isLegal flag is set during assignment evaluation. This may
      also be tricky because assignment added by
      evaluationPhase=afterAssignments will not be evaluated again ...
      but as this is legalization case it might work for you.<br>
      <br>
      <pre class="moz-signature" cols="72">-- 
Radovan Semancik
Software Architect
evolveum.com</pre>
      <br>
      <br>
      On 07/27/2015 10:23 PM, Martin Lízner - AMI Praha a.s. wrote:<br>
    </div>
    <blockquote
cite="mid:CALOh8eM0p6e5rAT8-eTpfQN3w88VmONzUZECOSrEgj7r8_G6dg@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hi, just quick question. Is there a tool/piece of
        code/task etc. that can transform user's resource links (e.g.
        loaded with reconc.) to assignments? Thank You, Martin
        <div><br clear="all">
          <div>
            <div class="gmail_signature">
              <div dir="ltr">
                <div>
                  <table
style="font-family:Verdana,Arial,Helvetica,sans-serif;border-collapse:collapse;padding:0px;margin:0px;border-width:0px!important;border-style:solid!important;width:482px!important">
                    <tbody>
                      <tr style="padding:0px;margin:0px;border:0px solid
                        gray!important">
                        <td colspan="2"
                          style="color:rgb(0,0,0);font-family:Arial,sans-serif;font-size:11px;vertical-align:bottom;padding:0px;border:0px
                          solid gray!important">
                          <p><span
                              style="font-size:14px;font-weight:bold">Martin
                              Lízner</span><br>
                            solution architect<br>
                            <br>
                            gsm: [+420] 737 745 571<br>
                            e-mail: <a moz-do-not-send="true"
                              href="mailto:jmeno.prijmeni@ami.cz"
                              target="_blank">martin.lizner@ami.cz</a></p>
                        </td>
                        <td
style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:10px;border-right-width:1px;border-right-style:solid;border-right-color:rgb(204,204,204);padding:0px;border-top-width:0px!important;border-bottom-width:0px!important;border-left-width:0px!important;border-top-style:solid!important;border-bottom-style:solid!important;border-left-style:solid!important;border-top-color:gray!important;border-bottom-color:gray!important;border-left-color:gray!important">   </td>
                        <td
                          style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:10px;padding:0px;border:0px
                          solid gray!important">   </td>
                        <td
                          style="color:rgb(0,0,0);font-family:Arial,sans-serif;font-size:11px;vertical-align:bottom;padding:0px;border:0px
                          solid gray!important">
                          <p>AMI Praha a.s.<br>
                            Pláničkova 11<br>
                            162 00 Praha 6<br>
                            tel.: [+420] 274 783 239<br>
                            web: <a moz-do-not-send="true"
                              href="http://www.ami.cz/" target="_blank">www.ami.cz</a></p>
                        </td>
                        <td
style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:10px;border-right-width:1px;border-right-style:solid;border-right-color:rgb(204,204,204);padding:0px;border-top-width:0px!important;border-bottom-width:0px!important;border-left-width:0px!important;border-top-style:solid!important;border-bottom-style:solid!important;border-left-style:solid!important;border-top-color:gray!important;border-bottom-color:gray!important;border-left-color:gray!important">   </td>
                        <td
                          style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:10px;padding:0px;border:0px
                          solid gray!important">   </td>
                        <td
                          style="color:rgb(0,0,0);font-family:Arial,sans-serif;font-size:11px;margin:8px;border:0px
                          solid gray!important">
                          <p><img moz-do-not-send="true"
                              src="http://www.ami.cz/images/podpis/ami_logo.gif"
                              alt="" style="border:0px"></p>
                        </td>
                      </tr>
                      <tr style="padding:0px;margin:0px;border:0px solid
                        gray!important">
                        <td colspan="8"
                          style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:10px;padding:0px;border:0px
                          solid gray!important"><br>
                          <a moz-do-not-send="true"
href="http://www.ami.cz/reseni-a-sluzby/bezpecnost-dat/audit-roli-a-opravneni-sap"
                            target="_blank"><img moz-do-not-send="true"
src="http://www.ami.cz/images/podpis/AMI-podpis-AuditSAP_1.png" alt=""
                              style="border:0px;width:480px;height:82px"></a></td>
                      </tr>
                      <tr style="padding:0px;margin:0px;border:0px solid
                        gray!important">
                        <td colspan="8"
                          style="color:rgb(128,128,128);font-family:Arial,sans-serif;font-size:11px;padding:0px;border:0px
                          solid gray!important"><br>
                          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.</td>
                      </tr>
                    </tbody>
                  </table>
                </div>
                <br>
              </div>
            </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>
    <br>
    <pre class="moz-signature" cols="72">
</pre>
  </body>
</html>