[midPoint] Conditional Assignments

Ivan Noris ivan.noris at evolveum.com
Tue Nov 24 16:28:19 CET 2015


Hi Samu,

although I'm not assigning resource account but a role instead, this is
my working code:

   <mapping>
        <name>My Object Template: Assign Role XYZ</name>
        <authoritative>true</authoritative>
        <source>
                <path>$user/employeeType</path>
        </source>
        <expression>
                <assignmentTargetSearch>
                        <targetType>c:RoleType</targetType>
                        <oid>00000000-dc00-dc00-0004-000000000077</oid>
                </assignmentTargetSearch>
        </expression>
        <target>
                <path>assignment</path>
        </target>
        <condition>
                <script>
                    <code>employeeType == 'employee'</code>
                </script> 
        </condition>
    </mapping>

Could you please the construction from the above - for your case
probably you need to change c:RoleType to c:ResourceType...

Some other questions:
1) are other mappings from the same object template working? (To avoid
problem of not using template at all...)
2) how is the attribute organization set in your scenario?

Best regards,
Ivan

On 11/24/2015 04:06 PM, Samu Viitanen wrote:
> Hello,
>
> I am having trouble finding a solution on how to create conditional
> assignments in an Object Template. I have an Object Template and I
> would like to see if the Focus user's attribute "organization" matches
> to a specific string before creating my assignment. See mapping below
>
>    <mapping>
>       <source>
>          <c:path>organization</c:path>
>       </source>
>       <expression>
>          <value>
>             <targetRef oid="resource-oid-123-456" type="c:ResourceType"/>
>          </value>
>       </expression>
>       <target>
>          <c:path>assignment</c:path>
>       </target>
>       <condition>
>          <script>
>             <description>
>                 Create a condition to see that the organization matches
>             </description>
>             <code>organization == 'org'</code>
>          </script>
>       </condition>
>    </mapping>
>
> This is the point where I am stuck. I figured that the example above
> is somewhat correct, but the condition is still never true even though
> I know my focus user's organization is 'org'. I am not very familiar
> with expressions and conditions yet. I tried to find the answer in
> Wiki, but didn't find a related example. I also looked into the live
> demo's Object Template, where a similar thing is done, but it did not
> help me here.
>
> Best Regards
> Samu Viitanen
>
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint

-- 
  Ing. Ivan Noris
  Senior Identity Management Engineer & IDM Architect
  evolveum.com                     evolveum.com/blog/
  ___________________________________________________
  "Semper Id(e)M Vix."

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20151124/2898b946/attachment.htm>


More information about the midPoint mailing list