<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Ubuntu;
        panose-1:2 11 5 4 3 6 2 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.DefaultFontHxMailStyle
        {mso-style-name:"Default Font HxMail Style";
        font-family:"Ubuntu",sans-serif;
        color:windowtext;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US">
<div>But students can be employed. I need it so that if they aren't in that resource, they are removed. You're earlier example makes some sense, but I don't have a deep enough understanding of midPoint to fully implement it. Error complains about the source
 of $user/assignments. I'm on 4.1 and it looks like that may have changed some, but I can't quite figure out how.</div>
<div><br>
</div>
<div>Kind of frustrated as this seems like it should be a basic operation, and it's the one thing stopping me from going further. I don't want a mess of stale data in a brand new system a day after it goes up.
</div>
<div><br>
</div>
<div>I've been looking at queries and bulk actions, but I can't figure out how to find all users that aren't referenced by a resource. I can find all in the resource, and all that have a resource that isn't it (which is all of the users as names are pulled
 in from a different resource). What is a one minute query in raw SQL is beyond my understanding here right now.</div>
<div><br>
</div>
<div>On Thu, 2020-07-02 at 13:15 -0500, Jason Everling wrote:</div>
<blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex">
<div class="WordSection1">
<p class="MsoNormal"><span class="DefaultFontHxMailStyle">Also this in the default template, if return null; doesn’t work you could also go with return ‘’; . So many different ways to do it without relying on a deleted template<o:p></o:p></span></p>
<p class="MsoNormal"><span class="DefaultFontHxMailStyle"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:9.6pt"><mapping><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">  <description>Clean out department</description><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">  <strength>strong</strength><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">  <source><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">    <path>$user/extension/your_affiliation</path><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">  </source><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">  <target><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">    <path>$user/extension/ndsuPrimaryJobTitle</path><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">  </target><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">  <expression><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">    <script><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">      <code><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">       if (affiliation == ‘student’) {<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">            return null;<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">        }<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">      </code><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">    </script><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">  </expression><o:p></o:p></p>
<p class="MsoNormal"></mapping><span class="DefaultFontHxMailStyle"><o:p></o:p></span></p>
<p class="MsoNormal"><span class="DefaultFontHxMailStyle"><o:p> </o:p></span></p>
<p class="MsoNormal"><span class="DefaultFontHxMailStyle"><o:p> </o:p></span></p>
<div style="mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="border:none;padding:0in"><b>From: </b><a href="mailto:jeverling@bshp.edu">Jason Everling</a><br>
<b>Sent: </b>Thursday, July 2, 2020 1:06 PM<br>
<b>To: </b><a href="mailto:midpoint@lists.evolveum.com">midPoint General Discussion</a><br>
<b>Subject: </b>RE: [midPoint] How to blank out user properties?</p>
</div>
<p class="MsoNormal"><span class="DefaultFontHxMailStyle"><o:p> </o:p></span></p>
<p class="MsoNormal"><span class="DefaultFontHxMailStyle"><i>* only if the resource isn’t assigned?<o:p></o:p></i></span></p>
<p class="MsoNormal"><span class="DefaultFontHxMailStyle"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From: </b><a href="mailto:jeverling@bshp.edu">Jason Everling</a><br>
<b>Sent: </b>Thursday, July 2, 2020 1:04 PM<br>
<b>To: </b><a href="mailto:midpoint@lists.evolveum.com">midPoint General Discussion</a><br>
<b>Subject: </b>RE: [midPoint] How to blank out user properties?<o:p></o:p></p>
</div>
<p class="MsoNormal"><span class="DefaultFontHxMailStyle"><o:p> </o:p></span></p>
<p class="MsoNormal"><span class="DefaultFontHxMailStyle">What about just a regular mapping in the default user template with a condition strong that gets applied and only if the resource is assigned?<o:p></o:p></span></p>
<p class="MsoNormal"><span class="DefaultFontHxMailStyle"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:9.6pt"><mapping><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">  <description>Clean out department</description><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">  <strength>strong</strength><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">  <source><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">    <path>$user/assignments</path><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">  </source><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">  <target><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">    <path>$user/extension/ndsuPrimaryJobTitle</path><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">  </target><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">  <expression><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">    <script><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">      <code><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">       if (assignment != your resource) {<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">            return null;<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">        }<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">      </code><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">    </script><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:9.6pt">  </expression><o:p></o:p></p>
<p class="MsoNormal"></mapping><span class="DefaultFontHxMailStyle"><o:p></o:p></span></p>
<p class="MsoNormal"><span class="DefaultFontHxMailStyle"><o:p> </o:p></span></p>
<p class="MsoNormal"><span class="DefaultFontHxMailStyle"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From: </b><a href="mailto:richard.frovarp@ndsu.edu">Richard Frovarp</a><br>
<b>Sent: </b>Thursday, July 2, 2020 12:56 PM<br>
<b>To: </b><a href="mailto:midpoint@lists.evolveum.com">midpoint@lists.evolveum.com</a><br>
<b>Subject: </b>Re: [midPoint] How to blank out user properties?<o:p></o:p></p>
</div>
<p class="MsoNormal"><span class="DefaultFontHxMailStyle"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal">I've seen your archive example. I wasn't completely clear. I don't want to archive the old value. I just want it gone. I want to keep the user object though. So if I were to leave NDSU, we would want there to still be the name, employee
 number, etc to remain. But my title would no longer apply. A bigger deal if I were to become a student, we wouldn't want my job title applied to my AD object for instance as it wouldn't be applicable. Just trying to get the value back to null.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">On Thu, 2020-07-02 at 12:22 -0500, Jason Everling wrote:<o:p></o:p></p>
</div>
<blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex">
<p class="MsoNormal" style="margin-left:.2in"><span class="DefaultFontHxMailStyle">So what I can read from, you want to archive the old value? We do this for various attributes when they are changed, see here, I had added it to the midpoint samples a while
 back, it will take the old value which was previously set and then add it to a custom schema attribute for archival history, such as a username change, level change, affiliation, etc..<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.2in"><span class="DefaultFontHxMailStyle"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.2in"><a href="https://github.com/evolveum/midpoint-samples/blob/master/samples/contrib/bshp/objects/objectTemplates/Includes%20-%20Archiving.xml">https://github.com/evolveum/midpoint-samples/blob/master/samples/contrib/bshp/objects/objectTemplates/Includes%20-%20Archiving.xml</a><span class="DefaultFontHxMailStyle"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.2in"><span class="DefaultFontHxMailStyle"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-left:.2in"><b>From: </b><a href="mailto:richard.frovarp@ndsu.edu">Richard Frovarp</a><br>
<b>Sent: </b>Thursday, July 2, 2020 11:13 AM<br>
<b>Subject: </b>[midPoint] How to blank out user properties?<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-left:.2in"><span class="DefaultFontHxMailStyle"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.2in">I'm reading a list of our employees from a DB through a<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">DatabaseTableConnector resource. As part of that process I'm setting a<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">custom schema element that is their title. That's fine. However, when<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">they are no longer employed, they disappear from the database table.<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.2in">So I'm trying to blank out the title property, since if they aren't<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">employed anymore, they don't have a title. We want to keep historic<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">records, and they may still be a student, which we wouldn't populate a<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">title.<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.2in">How does one go about doing this? It was suggested using an object<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">template on the deleted situation, but that doesn't appear to be<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">working.<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.2in">Resource:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.2in"><reaction><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">  <situation>deleted</situation><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">  <synchronize>true</synchronize><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">  <action><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">    <handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">-3#unlink</handlerUri>;<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">  </action><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">  <objectTemplateRef oid="5b23b0d3-0740-47a1-932d-c5a4ab513bc4" /><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in"></reaction><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.2in">User Template:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.2in"><mapping><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">  <description>Clean out department</description><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">  <strength>strong</strength><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">  <target><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">    <path>$user/extension/ndsuPrimaryJobTitle</path><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">  </target><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">  <expression><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">    <script><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">      <code>null</code><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">    </script><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">  </expression><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in"></mapping><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.2in">No errors are thrown, it's just that the title element remains populate<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">with the last know value when the user is deleted from the resource.<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.2in">Thanks,<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">Richard<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">_______________________________________________<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">midPoint mailing list<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">midPoint@lists.evolveum.com<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in">https://lists.evolveum.com/mailman/listinfo/midpoint<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.2in"><span class="DefaultFontHxMailStyle"><o:p> </o:p></span></p>
<pre>_______________________________________________</pre>
<pre>midPoint mailing list</pre>
<pre><a href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a></pre>
<pre><a href="https://lists.evolveum.com/mailman/listinfo/midpoint">https://lists.evolveum.com/mailman/listinfo/midpoint</a></pre>
</blockquote>
<pre style="margin-left:4.8pt"><o:p> </o:p></pre>
<p class="MsoNormal"><span class="DefaultFontHxMailStyle"><o:p> </o:p></span></p>
<p class="MsoNormal"><span class="DefaultFontHxMailStyle"><o:p> </o:p></span></p>
<p class="MsoNormal"><span class="DefaultFontHxMailStyle"><o:p> </o:p></span></p>
</div>
<pre>_______________________________________________</pre>
<pre>midPoint mailing list</pre>
<pre><a href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a></pre>
<pre><a href="https://lists.evolveum.com/mailman/listinfo/midpoint">https://lists.evolveum.com/mailman/listinfo/midpoint</a></pre>
<pre><br></pre>
</blockquote>
</body>
</html>