<html xmlns:v="urn:schemas-microsoft-com:vml" 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:Courier;
panose-1:2 7 4 9 2 2 5 2 4 4;}
@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:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
font-size:10.0pt;
font-family:"Courier New";}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;}
span.EmailStyle22
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-ligatures:none;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">This is the <activity> section from a I task I used to unassign all orgs from all users with existing assignments. After running that, I let midPoint put back what was supposed to be there.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Maybe it will help you…<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> <activity><o:p></o:p></p>
<p class="MsoNormal"> <work><o:p></o:p></p>
<p class="MsoNormal"> <iterativeScripting><o:p></o:p></p>
<p class="MsoNormal"> <objects><o:p></o:p></p>
<p class="MsoNormal"> <type>UserType</type><o:p></o:p></p>
<p class="MsoNormal"> <query> <!-- to process only relevant users --><o:p></o:p></p>
<p class="MsoNormal"> <q:filter><o:p></o:p></p>
<p class="MsoNormal"> <q:text>assignment/targetRef matches (targetType = OrgType)</q:text><o:p></o:p></p>
<p class="MsoNormal"> </q:filter><o:p></o:p></p>
<p class="MsoNormal"> </query><o:p></o:p></p>
<p class="MsoNormal"> </objects><o:p></o:p></p>
<p class="MsoNormal"> <scriptExecutionRequest><o:p></o:p></p>
<p class="MsoNormal"> <s:unassign><o:p></o:p></p>
<p class="MsoNormal"> <s:filter><o:p></o:p></p>
<p class="MsoNormal"> <q:text>targetRef matches (targetType = OrgType)</q:text><o:p></o:p></p>
<p class="MsoNormal"> </s:filter><o:p></o:p></p>
<p class="MsoNormal"> </s:unassign><o:p></o:p></p>
<p class="MsoNormal"> </scriptExecutionRequest><o:p></o:p></p>
<p class="MsoNormal"> </iterativeScripting><o:p></o:p></p>
<p class="MsoNormal"> </work><o:p></o:p></p>
<p class="MsoNormal"> </activity><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> midPoint <midpoint-bounces@lists.evolveum.com> <b>
On Behalf Of </b>Markus Calmius via midPoint<br>
<b>Sent:</b> Wednesday, January 10, 2024 8:51 AM<br>
<b>To:</b> midPoint General Discussion <midpoint@lists.evolveum.com><br>
<b>Cc:</b> Markus Calmius <markus.calmius@proton.ch><br>
<b>Subject:</b> [midPoint] bulk unassign deleted role or org<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">Hi,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">is it possible, and if so, can anyone guide me on how to unassign all roles (or orgs) that has been deleted*. <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">I've been trying to use the bulk script actions, but I cannot figure out how to figure out how to compose the filter.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">All my tests end up with either a stack-trace or "There are no roles nor resources to unassign and no filter is specified"<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">What I got working was the example:<o:p></o:p></span></p>
</div>
<div>
<p style="margin:0in;background:#FCF4DC"><span style="font-size:10.0pt;font-family:Courier;color:#D11C24"><s:action><o:p></o:p></span></p>
<p style="margin:0in;background:#FCF4DC"><span style="font-size:10.0pt;font-family:Courier;color:#D11C24"> <s:type>unassign</s:type><o:p></o:p></span></p>
<p style="margin:0in;background:#FCF4DC"><span style="font-size:10.0pt;font-family:Courier;color:#D11C24"> <s:parameter><o:p></o:p></span></p>
<p style="margin:0in;background:#FCF4DC"><span style="font-size:10.0pt;font-family:Courier;color:#D11C24"> <s:name>role</s:name><o:p></o:p></span></p>
<p style="margin:0in;background:#FCF4DC"><span style="font-size:10.0pt;font-family:Courier;color:#D11C24"> <c:value xsi:type="xsd:string”>OID</c:value><o:p></o:p></span></p>
<p style="margin:0in;background:#FCF4DC"><span style="font-size:10.0pt;font-family:Courier;color:#D11C24"> </s:parameter><o:p></o:p></span></p>
<p style="margin:0in;background:#FCF4DC"><span style="font-size:10.0pt;font-family:Courier;color:#D11C24"></s:action><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">But that take one OID, and... I need to have at least a list, but preferably something even smarter.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">I tried to do something like this:<o:p></o:p></span></p>
</div>
<div>
<div>
<pre style="background:#FDF6E3"><span style="color:#93A1A1"><</span><b><span style="color:#6C71C4">s</span><span style="color:#268BD2">:action</span></b><span style="color:#93A1A1">><br> <</span><b><span style="color:#6C71C4">s</span><span style="color:#268BD2">:type</span></b><span style="color:#93A1A1">></span><span style="color:#586E75">unassign</span><span style="color:#93A1A1"></</span><b><span style="color:#6C71C4">s</span><span style="color:#268BD2">:type</span></b><span style="color:#93A1A1">><br> <</span><b><span style="color:#6C71C4">s</span><span style="color:#268BD2">:parameter</span></b><span style="color:#93A1A1">><br> <</span><b><span style="color:#6C71C4">s</span><span style="color:#268BD2">:name</span></b><span style="color:#93A1A1">></span><span style="color:#586E75">filter</span><span style="color:#93A1A1"></</span><b><span style="color:#6C71C4">s</span><span style="color:#268BD2">:name</span></b><span style="color:#93A1A1">><br> <</span><b><span style="color:#6C71C4">s</span><span style="color:#268BD2">:searchFilter</span></b><span style="color:#93A1A1">><br> <</span><b><span style="color:#6C71C4">q</span><span style="color:#268BD2">:inOid</span></b><span style="color:#93A1A1">><br> <</span><b><span style="color:#6C71C4">q</span><span style="color:#268BD2">:value</span></b><span style="color:#93A1A1">></span><span style="color:#586E75">fef34a49-f7d4-4a68-97ee-cb240fe13022</span><span style="color:#93A1A1"></</span><b><span style="color:#6C71C4">q</span><span style="color:#268BD2">:value</span></b><span style="color:#93A1A1">><br> <</span><b><span style="color:#6C71C4">q</span><span style="color:#268BD2">:value</span></b><span style="color:#93A1A1">></span><span style="color:#586E75">f379d31e-6990-4226-8007-932b9676a8ff</span><span style="color:#93A1A1"></</span><b><span style="color:#6C71C4">q</span><span style="color:#268BD2">:value</span></b><span style="color:#93A1A1">><br> </</span><b><span style="color:#6C71C4">q</span><span style="color:#268BD2">:inOid</span></b><span style="color:#93A1A1">><br> </</span><b><span style="color:#6C71C4">s</span><span style="color:#268BD2">:searchFilter</span></b><span style="color:#93A1A1">><br> </</span><b><span style="color:#6C71C4">s</span><span style="color:#268BD2">:parameter</span></b><span style="color:#93A1A1">><br></</span><b><span style="color:#6C71C4">s</span><span style="color:#268BD2">:action</span></b><span style="color:#93A1A1">></span><span style="color:#586E75"><o:p></o:p></span></pre>
</div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">But cannot get any thing to work.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">Anyway, any pointers is greatly appreciated.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">* I know there is a message saying this role/org has members, do you still want to etc. <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">Markus<o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</body>
</html>