<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Stéphane,</p>
    <p>I am glad you found the solution. And there is no need to
      apologize! :)<br>
    </p>
    <pre class="moz-signature" cols="72">-- 
Pavol Mederly
Software developer
evolveum.com</pre>
    <div class="moz-cite-prefix">On 14/10/2022 10:30, Delcourt Stéphane
      via midPoint wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:GV1P190MB199530D131286F3B8A62B84484249@GV1P190MB1995.EURP190.PROD.OUTLOOK.COM">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <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-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;}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;}div.WordSection1
        {page:WordSection1;}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]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span lang="EN-US">Thanks a lot and sorry
            about the misunderstanding  of documentation here.<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">Found the solution:<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">I was placing policy
            rule on role B as assignment instead of inducement.<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
style="font-size:9.0pt;font-family:"Arial",sans-serif;color:black;mso-fareast-language:FR-BE"
                lang="FR">Stéphane Delcourt</span></b><span
style="font-size:9.0pt;font-family:"Arial",sans-serif;color:black;mso-fareast-language:FR-BE"
              lang="FR"><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
                  style="mso-fareast-language:FR-BE" lang="EN-US">From:</span></b><span
                style="mso-fareast-language:FR-BE" lang="EN-US">
                midPoint <a class="moz-txt-link-rfc2396E" href="mailto:midpoint-bounces@lists.evolveum.com"><midpoint-bounces@lists.evolveum.com></a>
                <b>On Behalf Of </b>Pavol Mederly via midPoint<br>
                <b>Sent:</b> Thursday, 13 October 2022 19:26<br>
                <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:midpoint@lists.evolveum.com">midpoint@lists.evolveum.com</a><br>
                <b>Cc:</b> Pavol Mederly <a class="moz-txt-link-rfc2396E" href="mailto:mederly@evolveum.com"><mederly@evolveum.com></a><br>
                <b>Subject:</b> Re: [midPoint] hasNoAssignment policy
                constraint<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p>Hello Stéphane,<o:p></o:p></p>
        <p>I would consider formulating the rule like this: "It is
          illegal to have a role B and not have role A (at the same
          time)" - forgetting about the assignment-oriented,
          transition-related "assignment" constraint, but simply using
          two object-oriented, state-related ones: hasAssignment,
          hasNoAssignment.<o:p></o:p></p>
        <pre>-- <o:p></o:p></pre>
        <pre>Pavol Mederly<o:p></o:p></pre>
        <pre>Software developer<o:p></o:p></pre>
        <pre>evolveum.com<o:p></o:p></pre>
        <div>
          <p class="MsoNormal">On 13/10/2022 17:08, Delcourt Stéphane
            via midPoint wrote:<o:p></o:p></p>
        </div>
        <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
          <p class="MsoNormal"><span lang="EN-US">Hi Pavol,</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></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.</span><o:p></o:p></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.</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">I now understand the
              meaning of “evaluated on” column in the wiki sorry about
              that.</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></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.</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
          <div>
            <p class="MsoNormal" style="line-height:13.5pt"><b><span
style="font-size:9.0pt;font-family:"Arial",sans-serif;color:black;mso-fareast-language:FR-BE"
                  lang="FR">Stéphane Delcourt</span></b><span
style="font-size:9.0pt;font-family:"Arial",sans-serif;color:black;mso-fareast-language:FR-BE"
                lang="FR"><br>
                Informaticien – Gestionnaire système - Développeur</span><o:p></o:p></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
                    style="mso-fareast-language:FR-BE" lang="EN-US">From:</span></b><span
                  style="mso-fareast-language:FR-BE" lang="EN-US">
                  midPoint
                  <a href="mailto:midpoint-bounces@lists.evolveum.com"
                    moz-do-not-send="true"><midpoint-bounces@lists.evolveum.com></a>
                  <b>On Behalf Of </b>Pavol Mederly via midPoint<br>
                  <b>Sent:</b> Wednesday, 12 October 2022 12:34<br>
                  <b>To:</b> <a
                    href="mailto:midpoint@lists.evolveum.com"
                    moz-do-not-send="true" class="moz-txt-link-freetext">midpoint@lists.evolveum.com</a><br>
                  <b>Cc:</b> Pavol Mederly <a
                    href="mailto:mederly@evolveum.com"
                    moz-do-not-send="true"><mederly@evolveum.com></a><br>
                  <b>Subject:</b> Re: [midPoint] hasNoAssignment policy
                  constraint</span><o:p></o:p></p>
            </div>
          </div>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
          <p><span lang="EN-US">Hello, Stéphane,</span><o:p></o:p></p>
          <p><span lang="EN-US">just a few general comments:</span><o:p></o:p></p>
          <ol type="1" start="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%7Cb0646af7b9ae4ea9c17308daad401051%7C30a5145e75bd4212bb028ff9c0ea4ae9%7C0%7C0%7C638012787927111951%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Re6tROg4dO3nul7syM7JqwoXjmSBgScZr8obXW9wbak%3D&reserved=0"
                moz-do-not-send="true"><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%7Cb0646af7b9ae4ea9c17308daad401051%7C30a5145e75bd4212bb028ff9c0ea4ae9%7C0%7C0%7C638012787927111951%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Zav91HQESQmUC6czdsLRVOr3IVdM5TKHkPyl1z7omtI%3D&reserved=0"
                moz-do-not-send="true"><span lang="EN-US">troubleshooting
                  with traces</span></a><span lang="EN-US"> to diagnose
                issues with them.</span><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">Personally, I would be greatly
                interested in how many installations do use policy
                rules, and this one in particular.</span><o:p></o:p></li>
          </ol>
          <pre><span lang="EN-US">-- </span><o:p></o:p></pre>
          <pre><span lang="EN-US">Pavol Mederly</span><o:p></o:p></pre>
          <pre><span lang="EN-US">Software developer</span><o:p></o:p></pre>
          <pre><span lang="EN-US">evolveum.com</span><o:p></o:p></pre>
          <div>
            <p class="MsoNormal"><span lang="EN-US">On 10/10/2022 12:54,
                Delcourt Stéphane via midPoint wrote:</span><o:p></o:p></p>
          </div>
          <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
            <p class="MsoNormal"><span lang="EN-US">Hi all,</span><o:p></o:p></p>
            <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
            <p class="MsoNormal"><span lang="EN-US">Does someone know
                how to deal with this policy constraint ?</span><o:p></o:p></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%7Cb0646af7b9ae4ea9c17308daad401051%7C30a5145e75bd4212bb028ff9c0ea4ae9%7C0%7C0%7C638012787927111951%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=0S7Qs0gQX5qbsWZb3dVU572g1hS9%2BaVD5m%2FH3YGaoGA%3D&reserved=0"
                moz-do-not-send="true"><span lang="EN-US">https://jira.evolveum.com/browse/MID-4068</span></a><o:p></o:p></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</span><o:p></o:p></p>
            <p class="MsoNormal"><span lang="EN-US">Here’s the code
                sample I’m using in role B:</span><o:p></o:p></p>
            <p class="MsoNormal"><span lang="EN-US">   
                <assignment></span><o:p></o:p></p>
            <p class="MsoNormal"><span lang="EN-US">       
                <policyRule></span><o:p></o:p></p>
            <p class="MsoNormal"><span lang="EN-US">           
                <name>exclude-if-no-role-a</name></span><o:p></o:p></p>
            <p class="MsoNormal"><span lang="EN-US">           
                <policyConstraints></span><o:p></o:p></p>
            <p class="MsoNormal"><span lang="EN-US">               
                <hasNoAssignment></span><o:p></o:p></p>
            <p class="MsoNormal"><span lang="EN-US">                   
                <targetRef oid="role_a_oid" type="RoleType"/></span><o:p></o:p></p>
            <p class="MsoNormal"><span lang="EN-US">               
                </hasNoAssignment></span><o:p></o:p></p>
            <p class="MsoNormal"><span lang="EN-US">           
                </policyConstraints></span><o:p></o:p></p>
            <p class="MsoNormal"><span lang="EN-US">           
                <policyActions></span><o:p></o:p></p>
            <p class="MsoNormal"><span lang="EN-US">               
                <enforcement/></span><o:p></o:p></p>
            <p class="MsoNormal"><span lang="EN-US">           
                </policyActions></span><o:p></o:p></p>
            <p class="MsoNormal"><span lang="EN-US">       
                </policyRule></span><o:p></o:p></p>
            <p class="MsoNormal"><span lang="EN-US">   
                </assignment></span><o:p></o:p></p>
            <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></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.</span><o:p></o:p></p>
            <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
            <p class="MsoNormal"><span lang="EN-US">What am I missing
                here ? </span><o:p></o:p></p>
            <p class="MsoNormal"><span lang="EN-US">I don’t even know
                how to debug this.</span><o:p></o:p></p>
            <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></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
style="font-size:9.0pt;font-family:"Arial",sans-serif;color:black;mso-fareast-language:FR-BE"
                  lang="FR">Stéphane Delcourt</span></b><span
style="font-size:9.0pt;font-family:"Arial",sans-serif;color:black;mso-fareast-language:FR-BE"
                lang="FR"><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%7Cb0646af7b9ae4ea9c17308daad401051%7C30a5145e75bd4212bb028ff9c0ea4ae9%7C0%7C0%7C638012787927111951%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=SlLmRQYl5Y%2F5cXW9u7M8UnqNMudZRL7jfsDL%2BBH1kLk%3D&reserved=0"
                title="Université libre de Bruxelles"
                moz-do-not-send="true"><span
style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#2B8DDB;mso-fareast-language:FR-BE;text-decoration:none"><img
                    style="width:5.4166in;height:.875in"
                    id="Image_x0020_1"
                    src="cid:part1.ZUoaaQPc.Ag08oXq9@evolveum.com"
                    alt="www.ulb.be" class="" width="520" height="84"
                    border="0"></span></a><span
style="font-size:9.0pt;font-family:"Arial",sans-serif;color:black;mso-fareast-language:FR-BE"
                lang="FR"><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>
                <br>
              </span><o:p></o:p></p>
            <pre><span lang="EN-US">_______________________________________________</span><o:p></o:p></pre>
            <pre><span lang="EN-US">midPoint mailing list</span><o:p></o:p></pre>
            <pre><a href="mailto:midPoint@lists.evolveum.com" moz-do-not-send="true"><span lang="EN-US">midPoint@lists.evolveum.com</span></a><o:p></o:p></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%7Cb0646af7b9ae4ea9c17308daad401051%7C30a5145e75bd4212bb028ff9c0ea4ae9%7C0%7C0%7C638012787927111951%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=aqSaLoFI%2B90srt4uNMFTfm1%2FYRYjIQbCGQi78zeJWJo%3D&reserved=0" moz-do-not-send="true"><span lang="EN-US">https://lists.evolveum.com/mailman/listinfo/midpoint</span></a><o:p></o:p></pre>
          </blockquote>
          <p class="MsoNormal"><span style="mso-fareast-language:FR-BE"><br>
              <br>
              <o:p></o:p></span></p>
          <pre>_______________________________________________<o:p></o:p></pre>
          <pre>midPoint mailing list<o:p></o:p></pre>
          <pre><a href="mailto:midPoint@lists.evolveum.com" moz-do-not-send="true" class="moz-txt-link-freetext">midPoint@lists.evolveum.com</a><o:p></o:p></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%7Cb0646af7b9ae4ea9c17308daad401051%7C30a5145e75bd4212bb028ff9c0ea4ae9%7C0%7C0%7C638012787927111951%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=aqSaLoFI%2B90srt4uNMFTfm1%2FYRYjIQbCGQi78zeJWJo%3D&reserved=0" moz-do-not-send="true">https://lists.evolveum.com/mailman/listinfo/midpoint</a><o:p></o:p></pre>
        </blockquote>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-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="https://lists.evolveum.com/mailman/listinfo/midpoint">https://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
    </blockquote>
  </body>
</html>