<div dir="ltr">I upgraded mP from 3.6.1 to 4.1 . I have a problem with role assignment in 4.1. MP created assignment without targetRef atribute. I have the following TC:<div>1) I create organization unit and metarole is automatically assigned for OU (defined in object template)</div><div>2) Metarole contains inducement to assign another read role to OU. In case that read role does not exists it create it (createOnDemand ) and assign it to OU. </div><div>3) Metarole is assigned automatically, read role is created ok, but assignemnt is NOT added successfully and I've got the following error:</div><div><span style="color:rgb(51,51,51);font-family:monospace;font-size:11px;white-space:pre-wrap">com.evolveum.midpoint.util.exception.SchemaException: The OID is null and filter could not be evaluated in assignment targetRef in org:2d4af0f0-7297-4c72-a445-6f70d8e98a8a(88888833)
at com.evolveum.midpoint.model.impl.lens.AssignmentEvaluator.resolveTargetsFromFilter(AssignmentEvaluator.java:756)
at com.evolveum.midpoint.model.impl.lens.AssignmentEvaluator.resolveTargets(AssignmentEvaluator.java:720)
at com.evolveum.midpoint.model.impl.lens.AssignmentEvaluator.getTargets(AssignmentEvaluator.java:681)
at com.evolveum.midpoint.model.impl.lens.AssignmentEvaluator.evaluateSegmentContent(AssignmentEvaluator.java:506)
at com.evolveum.midpoint.model.impl.lens.AssignmentEvaluator.evaluateFromSegment(AssignmentEvaluator.java:401)
at com.evolveum.midpoint.model.impl.lens.AssignmentEvaluator.evaluate(AssignmentEvaluator.java:270)
at com.evolveum.midpoint.model.impl.lens.projector.focus.AssignmentTripleEvaluator.evaluateAssignment(AssignmentTripleEvaluator.java:577)
at com.evolveum.midpoint.model.impl.lens.projector.focus.AssignmentTripleEvaluator.processAssignment(AssignmentTripleEvaluator.java:377)
at com.evolveum.midpoint.model.impl.lens.projector.focus.AssignmentTripleEvaluator.processAllAssignments(AssignmentTripleEvaluator.java:223)
at com.evolveum.midpoint.model.impl.lens.projector.focus.AssignmentProcessor.processAssignmentsProjectionsWithFocus(AssignmentProcessor.java:211)
at com.evolveum.midpoint.model.impl.lens.projector.focus.AssignmentProcessor.processAssignments(AssignmentProcessor.java:137)
at com.evolveum.midpoint.model.impl.lens.projector.focus.AssignmentHolderProcessor.lambda$processFocusFocus$4(AssignmentHolderProcessor.java:254)
at com.evolveum.midpoint.model.impl.lens.ClockworkMedic.partialExecute(ClockworkMedic.java:211)
at com.evolveum.midpoint.model.impl.lens.ClockworkMedic.partialExecute(ClockworkMedic.java:154)
at com.evolveum.midpoint.model.impl.lens.projector.focus.AssignmentHolderProcessor.processFocusFocus(AssignmentHolderProcessor.java:253)
at com.evolveum.midpoint.model.impl.lens.projector.focus.AssignmentHolderProcessor.processFocus(AssignmentHolderProcessor.java:101)
at com.evolveum.midpoint.model.impl.lens.projector.Projector.lambda$projectInternal$1(Projector.java:221)
at com.evolveum.midpoint.model.impl.lens.ClockworkMedic.partialExecute(ClockworkMedic.java:211)
at com.evolveum.midpoint.model.impl.lens.ClockworkMedic.partialExecute(ClockworkMedic.java:154)
at com.evolveum.midpoint.model.impl.lens.projector.Projector.projectInternal(Projector.java:219)
at com.evolveum.midpoint.model.impl.lens.projector.Projector.project(Projector.java:95)
at com.evolveum.midpoint.model.impl.lens.Clockwork.click(Clockwork.java:587)
at com.evolveum.midpoint.model.impl.lens.Clockwork.run(Clockwork.java:204)
at com.evolveum.midpoint.model.impl.controller.ModelController.executeChangesNonRaw(ModelController.java:421)
at com.evolveum.midpoint.model.impl.controller.ModelController.executeChanges(ModelController.java:389)
at jdk.internal.reflect.GeneratedMethodAccessor1476.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at com.evolveum.midpoint.util.aspect.MidpointInterceptor.invoke(MidpointInterceptor.java:32)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at com.sun.proxy.$Proxy147.executeChanges(Unknown Source)
at com.evolveum.midpoint.web.component.progress.ProgressPanel$14.callWithContextPrepared(ProgressPanel.java:668)
at com.evolveum.midpoint.web.component.progress.ProgressPanel$14.callWithContextPrepared(ProgressPanel.java:654)
at com.evolveum.midpoint.web.component.SecurityContextAwareCallable.call(SecurityContextAwareCallable.java:50)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)</span> <br></div><div><br></div><div>There is "n/a" assignment on the created OU and there is missing targetRef attribute in xml assignment code:</div><div> <assignment id="2"><br> <metadata><br> <requestTimestamp>2020-05-04T16:21:04.377+02:00</requestTimestamp><br> <requestorRef oid="00000000-0000-0000-0000-000000000002" relation="org:default" type="c:UserType"><br> <!-- administrator --><br> </requestorRef><br> <createTimestamp>2020-05-04T16:21:04.514+02:00</createTimestamp><br> <creatorRef oid="00000000-0000-0000-0000-000000000002" relation="org:default" type="c:UserType"><br> <!-- administrator --><br> </creatorRef><br> <createChannel><a href="http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user">http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user</a></createChannel><br> <originMappingName>Add READ Role</originMappingName><br> </metadata><br> <targetRef relation="org:default" type="c:RoleType"/><br> <activation><br> <effectiveStatus>enabled</effectiveStatus><br> </activation><br> </assignment><br></div><div><br></div><div>Metarole contains following inducement to role assignment:<br></div><div><inducement id="2"><br> <focusMappings><br> <mapping id="4"><br> <name>Add READ Role</name><br> <trace>true</trace><br> <strength>strong</strength><br> <source><br> <c:path>name</c:path><br> </source><br> <source><br> <c:path>displayName</c:path><br> </source><br> <expression><br> <assignmentTargetSearch xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>" xmlns:c="<a href="http://midpoint.evolveum.com/xml/ns/public/common/common-3">http://midpoint.evolveum.com/xml/ns/public/common/common-3</a>" xsi:type="c:AssignmentTargetSearchExpressionEvaluatorType"><br> <targetType>c:RoleType</targetType><br> <filter><br> <q:equal><br> <q:path xmlns:c="<a href="http://midpoint.evolveum.com/xml/ns/public/common/common-3">http://midpoint.evolveum.com/xml/ns/public/common/common-3</a>">c:name</q:path><br> <q:matching>polyStringOrig</q:matching><br> <expression><br> <script><br> <code>name + '_r'</code><br> </script><br> </expression><br> </q:equal><br> </filter><br> <createOnDemand>true</createOnDemand><br> <populateObject><br> <populateItem><br> <expression><br> <script xmlns:c="<a href="http://midpoint.evolveum.com/xml/ns/public/common/common-3">http://midpoint.evolveum.com/xml/ns/public/common/common-3</a>" xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>" xsi:type="c:ScriptExpressionEvaluatorType"><br> <code><br> name + '_r'<br> </code><br> </script><br> </expression><br> <target><br> <c:path>name</c:path><br> </target><br> </populateItem><br> <populateItem><br> <expression><br> <script xmlns:c="<a href="http://midpoint.evolveum.com/xml/ns/public/common/common-3">http://midpoint.evolveum.com/xml/ns/public/common/common-3</a>" xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>" xsi:type="c:ScriptExpressionEvaluatorType"><br> <code><br> displayName + '(' + name +')_r'<br> </code><br> </script><br> </expression><br> <target><br> <c:path>displayName</c:path><br> </target><br> </populateItem> <br> <populateItem><br> <expression><br> <value>LOC</value><br> </expression><br> <target><br> <c:path>subtype</c:path><br> </target><br> </populateItem><br> </populateObject><br> </assignmentTargetSearch><br> </expression><br> <target><br> <c:path>assignment</c:path><br> </target><br> </mapping><br> </focusMappings><br> </inducement><br></div><div><br></div><div> I also have tried mentioned TC on non-migrated and clean mP 4.1 and there works everything OK. </div><div> Any idea what should check ? Why midpoint is allowed to create assignment without targetRef atribut ?<br></div><div><br></div><div>Thanks</div><div>Lubomir Odlevak</div><div><br></div></div>