<div class="xam_msg_class">
<div style="font: normal 13px Arial; color:rgb(0, 0, 0);">Hi Radovan,<div><div><br></div><div>your clarification was very useful for me: I had lost the focus on this. </div><div><br></div><div>Now, I have configured new org for approvers and I have put an inducement <span style="background-color: transparent;">in it</span><span style="background-color: transparent;"> </span><span style="background-color: transparent;">for the role that grants access rights. Then, I have configured this org as approverRef in System Configuration object.</span></div><div><br></div><div>Thanks a lot and regards.</div><div><br></div><div>  Fabio</div><div><br></div><div><br>
<div><span style="font-family:Arial; font-size:11px; color:#5F5F5F;">Da</span><span style="font-family:Arial; font-size:12px; color:#5F5F5F; padding-left:5px;">: "midPoint" midpoint-bounces@lists.evolveum.com</span></div>
<div><span style="font-family:Arial; font-size:11px; color:#5F5F5F;">A</span><span style="font-family:Arial; font-size:12px; color:#5F5F5F; padding-left:5px;">: midpoint@lists.evolveum.com</span></div>
<div><span style="font-family:Arial; font-size:11px; color:#5F5F5F;">Cc</span><span style="font-family:Arial; font-size:12px; color:#5F5F5F; padding-left:5px;">: </span></div>
<div><span style="font-family:Arial; font-size:11px; color:#5F5F5F;">Data</span><span style="font-family:Arial; font-size:12px; color:#5F5F5F; padding-left:5px;">: Wed, 16 Sep 2015 11:27:30 +0200</span></div>
<div><span style="font-family:Arial; font-size:11px; color:#5F5F5F;">Oggetto</span><span style="font-family:Arial; font-size:12px; color:#5F5F5F; padding-left:5px;">: Re: [midPoint] Approver identified by role</span></div>
<br>

<div class="xam_msg_class">> 

  
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  
  
    <div class="moz-cite-prefix">> Hi,<br>> 
      <br>> 
      I'm not sure if I understand what you are trying to do. But
      perhaps one clarification is needed:<br>> 
      <br>> 
      In midPoint the roles are for giving access rights and
      organizations are for grouping identities. This is sometimes the
      same, but in some cases there is a big difference. It is explained
      here:<br>> 
      <br>> 
      <a class="moz-txt-link-freetext" href="https://wiki.evolveum.com/display/midPoint/Roles+and+Orgs" _djrealurl="https://wiki.evolveum.com/display/midPoint/Roles+and+Orgs">https://wiki.evolveum.com/display/midPoint/Roles+and+Orgs</a><br>> 
      <br>> 
      So, if you want to have a role that have multiple approvers then
      the easiest way is to put all the approvers in one Org and then
      use the Org as an approver. (Remember: a user may belong to any
      number of Orgs in midPoint).<br>> 
      <br>> 
      <pre class="moz-signature" cols="72">> -- 
Radovan Semancik
Software Architect
evolveum.com</pre>
      <br>> 
      <br>> 
      On 09/15/2015 12:45 PM, Fabio Contessi wrote:<br>> 
    </div>
    <blockquote cite="mid:3586FA04-61C5-4DCB-9A19-4F1531047654@nsr.it" type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      Hi,
      <div class="">> I have a problem with the approver expression in
        midpoint 3.2, in the xml object "System Configuration".</div>
      <div class=""><br class="">> 
      </div>
      <div class="">> I need to identify the approver by role assignment.
        So, I’m using this code snippet:</div>
      <div class=""><br class="">> 
      </div>
      <div class="">> 
        <div class="">> <approverExpression></div>
        <div class="">>     <description></description></div>
        <div class="">>     <script></div>
        <div class="">>         <code></div>
        <div class="">>             import
          com.evolveum.midpoint.prism.query.RefFilter</div>
        <div class="">>             import
          com.evolveum.midpoint.prism.PrismContext</div>
        <div class="">>             import
          com.evolveum.midpoint.prism.query.ObjectQuery</div>
        <div class="">>             import javax.xml.namespace.QName</div>
        <div class="">>             import
          com.evolveum.midpoint.prism.path.ItemPath</div>
        <div class="">>             import
          com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType</div>
        <div class="">>             import
          com.evolveum.midpoint.xml.ns._public.common.common_3.UserType</div>
        <div class="">>           </div>
        <div class="">>             String[] names =
          ["Role-Approvatore-AD-XXX"]</div>
        <div class="">>             PrismContext prismContext =
midpoint.createEmptyObject(UserType.class).asPrismObject().getPrismContext() </div>
        <div class="">>             RefFilter filter =
RefFilter.createReferenceEqual(UserType.F_ASSIGNMENT,UserType.class,prismContext,names)</div>
        <div class="">>             ObjectQuery query =
          ObjectQuery.createObjectQuery(filter)</div>
        <div class="">>             list =
          midpoint.searchObjects(UserType.class, query)</div>
        <div class="">>             for (def i = 0; i &lt;
          list.size(); i++) {</div>
        <div class="">>                 def oid = list.get(i).getOid()</div>
        <div class="">>                 lOut.add(oid)</div>
        <div class="">>             }</div>
        <div class="">>             return lOut</div>
        <div class="">>         </code></div>
        <div class="">>     </script></div>
        <div class="">> </approverExpression></div>
        <div class=""><br class="">> 
        </div>
        <div class="">> but I get this error:</div>
        <div class=""><br class="">> 
        </div>
        <div class="">> 
          <div class="">> Error:
            com.evolveum.midpoint.util.exception.ExpressionEvaluationException:
            java.lang.ClassCastException:
            com.evolveum.midpoint.prism.PrismContainerDefinition cannot
            be cast to
            com.evolveum.midpoint.prism.PrismReferenceDefinition (new)
            approverExpression</div>
          <div class="">> 2015-09-15 12:37:04,163 [MODEL] [Thread-57]
            ERROR
            (com.evolveum.midpoint.model.common.expression.Expression):
            Error evaluating expression in approverExpression:
            java.lang.ClassCastException:
            com.evolveum.midpoint.prism.PrismContainerDefinition cannot
            be cast to
            com.evolveum.midpoint.prism.PrismReferenceDefinition (new)
            approverExpression</div>
          <div class="">> com.evolveum.midpoint.util.exception.ExpressionEvaluationException:
            java.lang.ClassCastException:
            com.evolveum.midpoint.prism.PrismContainerDefinition cannot
            be cast to
            com.evolveum.midpoint.prism.PrismReferenceDefinition (new)
            approverExpression</div>
        </div>
        <div class=""><br class="">> 
        </div>
        <div class="">> Maybe I’m doing something wrong. Anyone could help
          me?</div>
        <div class=""><br class="">> 
        </div>
        <div class="">> Thanks and regards.</div>
        <div class=""><br class="">> 
        </div>
        <div class="">>   Fabio</div>
        <div class=""><br class="">> 
        </div>
        <div apple-content-edited="true" class="">> 
          <div style="color: rgb(0, 0, 0); letter-spacing: normal;              orphans: auto; text-align: start; text-indent: 0px;              text-transform: none; white-space: normal; widows: auto;              word-spacing: 0px; -webkit-text-stroke-width: 0px;              word-wrap: break-word; -webkit-nbsp-mode: space;              -webkit-line-break: after-white-space;" class="">> 
            <div style="color: rgb(0, 0, 0); letter-spacing: normal;                orphans: auto; text-align: start; text-indent: 0px;                text-transform: none; white-space: normal; widows: auto;                word-spacing: 0px; -webkit-text-stroke-width: 0px;                word-wrap: break-word; -webkit-nbsp-mode: space;                -webkit-line-break: after-white-space;" class="">> 
              <div style="color: rgb(0, 0, 0); letter-spacing: normal;                  orphans: auto; text-align: start; text-indent: 0px;                  text-transform: none; white-space: normal; widows: auto;                  word-spacing: 0px; -webkit-text-stroke-width: 0px;                  word-wrap: break-word; -webkit-nbsp-mode: space;                  -webkit-line-break: after-white-space;" class="">> 
                <div style="color: rgb(0, 0, 0); letter-spacing: normal;                    orphans: auto; text-align: start; text-indent: 0px;                    text-transform: none; white-space: normal; widows:                    auto; word-spacing: 0px; -webkit-text-stroke-width:                    0px; word-wrap: break-word; -webkit-nbsp-mode: space;                    -webkit-line-break: after-white-space;" class="">> 
                  <div class=""><br class="">> 
                  </div>
                  <div class=""><span class="" style="orphans: 2;                        widows: 2; color: rgb(17, 52, 80);"></span></div>> 
                </div>
              </div>
            </div>
          </div>
        </div>
        <br class="">> 
      </div>
      <br>> 
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>> 
      <pre wrap="">> _______________________________________________
midPoint mailing list
<a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com" _djrealurl="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<a class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint" _djrealurl="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
    </blockquote>
    <br>> 
    <br>> 
    <pre class="moz-signature" cols="72"></pre>> 
  


</div>
</div></div></div>
</div>