<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=iso-8859-1">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><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:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        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-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:91124284;
        mso-list-template-ids:1647242400;}
@list l1
        {mso-list-id:580599600;
        mso-list-template-ids:-850622580;}
@list l1:level1
        {mso-level-tab-stop:36.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level2
        {mso-level-tab-stop:72.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level3
        {mso-level-tab-stop:108.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level4
        {mso-level-tab-stop:144.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level5
        {mso-level-tab-stop:180.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level6
        {mso-level-tab-stop:216.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level7
        {mso-level-tab-stop:252.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level8
        {mso-level-tab-stop:288.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level9
        {mso-level-tab-stop:324.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></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="FR-BE" link="#0563C1" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi Pavol,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Thanks for all your suggestions, I did not knew about the third one and give it a try.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">IT helps me to understand that my policy constraint did not apply user having assignment to role A but role B having assignment to role A.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I now understand the meaning of “evaluated on” column in the wiki sorry about that.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Then I’m back at the beginning and my main goal is to achieve the opposite of exclusion constraint.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal" style="line-height:13.5pt"><b><span lang="FR" style="font-size:9.0pt;font-family:"Arial",sans-serif;color:black;mso-fareast-language:FR-BE">Stéphane Delcourt</span></b><span lang="FR" style="font-size:9.0pt;font-family:"Arial",sans-serif;color:black;mso-fareast-language:FR-BE"><br>
Informaticien – Gestionnaire système - Développeur</span><span style="mso-fareast-language:FR-BE"><o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="mso-fareast-language:FR-BE">From:</span></b><span lang="EN-US" style="mso-fareast-language:FR-BE"> midPoint <midpoint-bounces@lists.evolveum.com>
<b>On Behalf Of </b>Pavol Mederly via midPoint<br>
<b>Sent:</b> Wednesday, 12 October 2022 12:34<br>
<b>To:</b> midpoint@lists.evolveum.com<br>
<b>Cc:</b> Pavol Mederly <mederly@evolveum.com><br>
<b>Subject:</b> Re: [midPoint] hasNoAssignment policy constraint<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p><span lang="EN-US">Hello, Stéphane,<o:p></o:p></span></p>
<p><span lang="EN-US">just a few general comments:<o:p></o:p></span></p>
<ol start="1" type="1">
<li class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l1 level1 lfo3">
<span lang="EN-US">I would search the midPoint sources for <hasNoAssignment> string. We try to do the development seriously, so every feature should have (at least) one test for it.
</span>This one is no exception.<o:p></o:p></li><li class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l1 level1 lfo3">
<span lang="EN-US">I would search the docs.evolveum.com for "hasNoAssignment". Here the situation is a bit worse. The feature is not quite finished - it was sponsored to some extent; but additional resources are needed to document it properly. However, this
 work-in-progress document could help: </span><a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.evolveum.com%2Fmidpoint%2Fdevel%2Fdesign%2Fpolicy-constraints%2F&data=05%7C01%7Cstephane.delcourt%40ulb.be%7Cd67313fa622d4cb3d66b08daac3d4d2d%7C30a5145e75bd4212bb028ff9c0ea4ae9%7C0%7C0%7C638011676533015639%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=G2WKlpFoj1cbg%2BCV5RdYhI288qgWSL1P5G1yLGx%2BqMQ%3D&reserved=0"><span lang="EN-US">https://docs.evolveum.com/midpoint/devel/design/policy-constraints/</span></a><span lang="EN-US">.
</span>(The formatting problems are due to wiki migration.)<o:p></o:p></li><li class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l1 level1 lfo3">
<span lang="EN-US">As for debugging, policy constraints do not have "<tracing>" flag nor the comprehensive troubleshooting methodology (as mappings do). So I use the (experimental)
</span><a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.evolveum.com%2Fmidpoint%2Freference%2Fdiag%2Ftroubleshooting%2Ftroubleshooting-with-traces%2F&data=05%7C01%7Cstephane.delcourt%40ulb.be%7Cd67313fa622d4cb3d66b08daac3d4d2d%7C30a5145e75bd4212bb028ff9c0ea4ae9%7C0%7C0%7C638011676533015639%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=DqEIjiYn742xfO0Iw2Gm8VAYKyq4nWa%2B%2B%2BfYx9C2IeQ%3D&reserved=0"><span lang="EN-US">troubleshooting
 with traces</span></a><span lang="EN-US"> to diagnose issues with them.<o:p></o:p></span></li><li class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l1 level1 lfo3">
<span lang="EN-US">Personally, I would be greatly interested in how many installations do use policy rules, and this one in particular.<o:p></o:p></span></li></ol>
<pre><span lang="EN-US">-- <o:p></o:p></span></pre>
<pre><span lang="EN-US">Pavol Mederly<o:p></o:p></span></pre>
<pre><span lang="EN-US">Software developer<o:p></o:p></span></pre>
<pre><span lang="EN-US">evolveum.com<o:p></o:p></span></pre>
<div>
<p class="MsoNormal"><span lang="EN-US">On 10/10/2022 12:54, Delcourt Stéphane via midPoint wrote:<o:p></o:p></span></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span lang="EN-US">Hi all,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Does someone know how to deal with this policy constraint ?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">My idea is to use it for role dependency as intended
</span><a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fjira.evolveum.com%2Fbrowse%2FMID-4068&data=05%7C01%7Cstephane.delcourt%40ulb.be%7Cd67313fa622d4cb3d66b08daac3d4d2d%7C30a5145e75bd4212bb028ff9c0ea4ae9%7C0%7C0%7C638011676533015639%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=xabrJOgYrV6xsahqE%2B6Nb15p2JxU9CxLu4EUyGzpLgE%3D&reserved=0"><span lang="EN-US">https://jira.evolveum.com/browse/MID-4068</span></a><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">So I want to add policy constraint in role B to block user receiving it if not assigned of role A<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Here’s the code sample I’m using in role B:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">    <assignment><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">        <policyRule><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">            <name>exclude-if-no-role-a</name><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">            <policyConstraints><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">                <hasNoAssignment><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">                    <targetRef oid="role_a_oid" type="RoleType"/><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">                </hasNoAssignment><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">            </policyConstraints><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">            <policyActions><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">                <enforcement/><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">            </policyActions><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">        </policyRule><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">    </assignment><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">But this does not trigger any error when I try to assign role B to a user not having role A.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">What am I missing here ? <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I don’t even know how to debug this.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> <o:p></o:p></span></p>
<p class="MsoNormal">Thanks for your help<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:13.5pt">
<b><span lang="FR" style="font-size:9.0pt;font-family:"Arial",sans-serif;color:black;mso-fareast-language:FR-BE">Stéphane Delcourt</span></b><span lang="FR" style="font-size:9.0pt;font-family:"Arial",sans-serif;color:black;mso-fareast-language:FR-BE"><br>
Informaticien – Gestionnaire système - Développeur<br>
</span><a href="https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.ulb.ac.be%2F&data=05%7C01%7Cstephane.delcourt%40ulb.be%7Cd67313fa622d4cb3d66b08daac3d4d2d%7C30a5145e75bd4212bb028ff9c0ea4ae9%7C0%7C0%7C638011676533015639%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=alGcI06W34wT4LAClRb8ihDmqb3xXexRZLgcOkerWAE%3D&reserved=0" title="Université libre
            de Bruxelles"><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#2B8DDB;mso-fareast-language:FR-BE;text-decoration:none"><img border="0" width="520" height="84" style="width:5.4166in;height:.875in" id="Image_x0020_1" src="cid:image001.jpg@01D8DF1D.C8F2A360" alt="www.ulb.be"></span></a><span lang="FR" style="font-size:9.0pt;font-family:"Arial",sans-serif;color:black;mso-fareast-language:FR-BE"><br>
<b>Département informatique, Service Applications métier</b><br>
Av. F. Roosevelt 50, CP 251 - 1050 Bruxelles</span><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:FR-BE"><br>
<br>
<o:p></o:p></span></p>
<pre><span lang="EN-US">_______________________________________________<o:p></o:p></span></pre>
<pre><span lang="EN-US">midPoint mailing list<o:p></o:p></span></pre>
<pre><a href="mailto:midPoint@lists.evolveum.com"><span lang="EN-US">midPoint@lists.evolveum.com</span></a><span lang="EN-US"><o:p></o:p></span></pre>
<pre><a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.evolveum.com%2Fmailman%2Flistinfo%2Fmidpoint&data=05%7C01%7Cstephane.delcourt%40ulb.be%7Cd67313fa622d4cb3d66b08daac3d4d2d%7C30a5145e75bd4212bb028ff9c0ea4ae9%7C0%7C0%7C638011676533015639%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=%2F%2BJjNWEaJ41DNgijAvh51jCQfEBXo%2BB%2F3J7D11xv4ew%3D&reserved=0"><span lang="EN-US">https://lists.evolveum.com/mailman/listinfo/midpoint</span></a><span lang="EN-US"><o:p></o:p></span></pre>
</blockquote>
</div>
</body>
</html>