[midPoint] conditional matching for activation

Pálos Gustáv gustav.palos at evolveum.com
Wed Jan 4 06:17:07 CET 2017


Hi Jason,

please try in this way

 <attribute>
                <c:ref>*ri:currentLevel*</c:ref>  <!-- as 'input' in
expression -->
                <inbound>
                    <strength>strong</strength>
                    <source>
                        <c:path>$account/attributes/*ri:currentStatus*
</c:path>
                    </source>
                    <expression>
                        <script>
                            <code>
                                import
com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType;

                                if (*input *== 'FAC' &&
*currentStatus *== 'ACTIVE') {
                               return ActivationStatusType.ENABLED;
                                } else if (*input *== 'FAC' &&
*currentStatus *== 'RETIRED'){
                               return ActivationStatusType.DISABLED;
                                }
                                // and so on...

                                return ActivationStatusType.DISABLED;
                            </code>
                        </script>
                    </expression>
             *       <target>*
*                        <c:path>activation/administrativeStatus</c:path>*
*                    </target>*
                </inbound>
            </attribute>

best regards,

Gustav

2017-01-03 18:36 GMT+01:00 Jason Everling <jeverling at bshp.edu>:

> I am redesigning one of our main resources from a csv feed to a
> scriptedsql resource, 'because I created it a long time ago in a rush to
> get it going :( '
>
> When using activation, can operators be used or is there another way to
> handle it?
>
> Currently, in order for a user to be considered 'active' there must be 2
> conditions true
>
> currentLevel == 'FAC' && currentStatus == 'ACTIVE' would be considered
> 'enabled'
>
> currentLevel == 'FAC' && currentStatus == 'RETIRED' would be considered
> 'disabled'
>
> so on and so on.....
>
> Question is, can I use expressions/script/code for activation/administrativeStatus
> in the resource xml? Maybe like the below as an example of how?
>
>           <administrativeStatus>
>                     <inbound>
>                     <strength>strong</strength>
> <source>
>             <path>$shadow/attributes/ri:currentLevel</path>
>             </source>
>             <source>
>             <path>$shadow/attributes/ri:currentStatus</path>
>             </source>
>                     <expression>
>                         <script>
>                         <code>
> import com.evolveum.midpoint.xml.ns._public.common.common_3.
> ActivationStatusType;
> if (currentLevel == 'STU' && currentStatus == 'Freshman') {
> ActivationStatusType.ENABLED;
>                         } else if (currentLevel == 'FAC' && currentStatus
> == 'Active'){
>                         } else if (.....) {
>                                                 } else if (.....) {
> } else if (.....) {
> } else {
> ActivationStatusType.DISABLED;
> }
> </code>
> </script>
> </expression>
> </inbound>
> </administrativeStatus>
>
> Thanks!
>
> JASON
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint
>
>


-- 
Gustáv Pálos
Identity Engineer
evolveum.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170104/fae05d85/attachment.htm>


More information about the midPoint mailing list