<div dir="ltr">Your code looks like a mix of two things you need to implement separately.<div>1) Schema handling must be responsible for update of an Org</div><div>2) User objectTemplate must be responsible for manager assignment/revocation </div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 14 Oct 2022 at 20:02, Ruy Minoru Ito Takata via midPoint <<a href="mailto:midpoint@lists.evolveum.com">midpoint@lists.evolveum.com</a>> wrote:<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 class="msg-2703769444060307962">




<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi,
<div>I'm using CSV file to create a org tree and assign a manager to each one. But when there are a change in manager, the new manager is added and the old manager is not removed.</div>
<div><br>
</div>
<div>Like in the book, the org CSV has orgnum, orgname, and manager identifier. I made two resources, one to build the org tree, and another to assign manager to the orgs.</div>
<div><br>
</div>
<div>The resource that assigns manager to the orgs has a assignmentTargetSearch to find the org and change the assignment attribute of the user. So, when a user is no more manager of an org, his identifier disappear from the CSV file.</div>
<div><br>
</div>
<div>What is the correct way to do this?</div>
<div><br>
</div>
<div>My CSV org file is like:</div>
<div>orgnum,orgname,orgmanager</div>
<div><br>
</div>
<div>My schemahandling:</div>
<div><schemaHandling>
<div>            <objectType></div>
<div>                <displayName>Organizational Unit Manager</displayName></div>
<div>                <objectClass>ri:AccountObjectClass</objectClass></div>
<div>                <kind>account</kind><br>
</div>
                <default>true</default>
<div>                <attribute></div>
<div>                    <ref>ri:orgmanager</ref>  <!-- employeeNumber --></div>
<div>                    <inbound></div>
<div>                        <target></div>
<div>                            <path>$focus/employeeNumber</path></div>
<div>                        </target></div>
<div>                    </inbound></div>
<div>                </attribute></div>
<div>                <attribute></div>
<div>                    <ref>ri:orgnum</ref> <!-- organization code --></div>
<div>                    <inbound></div>
<div>                        <expression></div>
<div>                            <assignmentTargetSearch></div>
<div>                                <targetType>c:OrgType</targetType></div>
<div>                                <assignmentProperties></div>
<div>                                    <relation>org:manager</relation></div>
<div>                                    <subtype>csvorgmanager</subtype></div>
<div>                                </assignmentProperties></div>
<div>                                <filter></div>
<div>                                    <q:equal></div>
<div>                                        <q:path>identifier</q:path></div>
<div>                                        <expression></div>
<div>                                            <path>$input</path></div>
<div>                                        </expression></div>
<div>                                    </q:equal></div>
<div>                                </filter></div>
<div>                            </assignmentTargetSearch></div>
<div>                        </expression></div>
<div>                        <target></div>
<div>                            <path>$focus/assignment</path></div>
<div>                            <set></div>
<div>                                <condition></div>
<div>                                    <script></div>
<div>                                        <code></div>
<div>                                            return input.subtype.contains("csvorgmanager")</div>
<div>                                        </code></div>
<div>                                    </script></div>
<div>                                </condition></div>
<div>                            </set></div>
<div>                        </target></div>
<div>                    </inbound></div>
<div>                </attribute></div>
<div>            </objectType></div>
        </schemaHandling><br>
</div>
<br>
</div>
<div id="m_-4281198181954078356Signature">
<div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<div style="margin-top:20px">Thanks<br>
</div>
<div style="margin-top:20px"><img alt="Serpro" style="float: left; margin-top: 0%; margin-right: 11px;" width="156" height="88" src="https://servicos.serpro.gov.br/assets/img/assinatura_email_nova_serpro.png">
<div style="float:left;color:rgb(143,145,144);font-size:12px;font-family:Arial,sans-serif;border-left:1px solid rgb(209,213,216);padding-left:11px;min-height:72px">
<div style="color:rgb(73,74,76)"><strong>Ruy Minoru Ito Takata</strong></div>
<div style="margin:5px 0px"></div>
<div style="margin:5px 0px">Analista</div>
<div style="margin:5px 0px">Superintendência de Segurança da Informação</div>
<div style="margin:5px 0px">Diretoria de Operações</div>
<div>+55 (11) 2173-1799</div>
<div></div>
</div>
</div>
<span style="clear:left"></span><br>
</div>
</div>
</div>
</div>
<span id="m_-4281198181954078356LGPD"><br>
<br>
“Essa mensagem do SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO), empresa pública federal regida pelo disposto na Lei Federal nº 5.615, é enviada exclusivamente ao destinatário informado e pode conter dados pessoais, protegidos pela Lei Geral de Proteção
 de Dados (Lei 13.709/2018), assim como informações confidenciais, protegidas por sigilo profissional. O SERPRO ressalta seu comprometimento em assegurar a segurança e a proteção das informações contidas neste e-mail e informa que a sua utilização desautorizada
 é ilegal e sujeita o infrator às penas da lei. Se você o recebeu indevidamente, queira, por gentileza, reenviá-lo ao emitente, esclarecendo o equívoco.” “This message from SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO) - a government company established
 under Brazilian law (5.615/70) - is directed exclusively to its addressee and may contain personal data protected by the General Data Protection Law (13.709/2018) as well as confidencial data, protected under professional secrecy rules. SERPRO highlights its
 commitment to ensuring the security and protection of the information contained in this email and its unauthorized use is illegal and may subject the transgressor to the law´s penalties. If you´re not the addressee, please send it back, elucidating the failure.”
</span>
</div>

_______________________________________________<br>
midPoint mailing list<br>
<a href="mailto:midPoint@lists.evolveum.com" target="_blank">midPoint@lists.evolveum.com</a><br>
<a href="https://lists.evolveum.com/mailman/listinfo/midpoint" rel="noreferrer" target="_blank">https://lists.evolveum.com/mailman/listinfo/midpoint</a><br>
</div></blockquote></div>