<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hello Stéphane,</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.<br>
    </p>
    <pre class="moz-signature" cols="72">-- 
Pavol Mederly
Software developer
evolveum.com</pre>
    <div class="moz-cite-prefix">On 13/10/2022 17:08, Delcourt Stéphane
      via midPoint wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:GV1P190MB19955B573FEFF5E7504945E884259@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">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
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> Wednesday, 12 October 2022 12:34<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"><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 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%7Cd67313fa622d4cb3d66b08daac3d4d2d%7C30a5145e75bd4212bb028ff9c0ea4ae9%7C0%7C0%7C638011676533015639%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=G2WKlpFoj1cbg%2BCV5RdYhI288qgWSL1P5G1yLGx%2BqMQ%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%7Cd67313fa622d4cb3d66b08daac3d4d2d%7C30a5145e75bd4212bb028ff9c0ea4ae9%7C0%7C0%7C638011676533015639%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=DqEIjiYn742xfO0Iw2Gm8VAYKyq4nWa%2B%2B%2BfYx9C2IeQ%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.<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"
              moz-do-not-send="true"><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
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%7Cd67313fa622d4cb3d66b08daac3d4d2d%7C30a5145e75bd4212bb028ff9c0ea4ae9%7C0%7C0%7C638011676533015639%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=alGcI06W34wT4LAClRb8ihDmqb3xXexRZLgcOkerWAE%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.betDcNWv.Mmv00OUP@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>
              <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" moz-do-not-send="true"><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" moz-do-not-send="true"><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>
      <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>