Skip to content

Commit

Permalink
Trying to avoid "No focus class in lens context; inducement targeted …
Browse files Browse the repository at this point in the history
…at focus type ... will not be applied: LensContextPlaceholder" error at user login.
  • Loading branch information
mederly committed Mar 24, 2017
1 parent 32daee8 commit 613d915
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 1,946 deletions.
Expand Up @@ -16,6 +16,7 @@
package com.evolveum.midpoint.model.impl.lens;

import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.util.DebugUtil;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;

Expand All @@ -28,8 +29,10 @@
*/
public class LensContextPlaceholder<F extends ObjectType> extends LensContext<F> {

public LensContextPlaceholder(PrismContext prismContext) {
public LensContextPlaceholder(PrismObject<F> focus, PrismContext prismContext) {
super(prismContext);
createFocusContext((Class<F>) focus.asObjectable().getClass());
getFocusContext().setLoadedObject(focus);
}

@Override
Expand Down
Expand Up @@ -195,7 +195,7 @@ private void initializePrincipalFromAssignments(MidPointPrincipal principal, Pri
principal.setApplicableSecurityPolicy(securityHelper.locateSecurityPolicy(userType.asPrismObject(), systemConfiguration, task, result));

if (!userType.getAssignment().isEmpty()) {
LensContext<UserType> lensContext = new LensContextPlaceholder<>(prismContext);
LensContext<UserType> lensContext = new LensContextPlaceholder<>(userType.asPrismObject(), prismContext);
AssignmentEvaluator.Builder<UserType> builder =
new AssignmentEvaluator.Builder<UserType>()
.repository(repositoryService)
Expand Down

0 comments on commit 613d915

Please sign in to comment.