Search in sources :

Example 36 with UserType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType in project midpoint by Evolveum.

the class MidPointAsserts method assertAssigned.

public static <F extends FocusType> AssignmentType assertAssigned(PrismObject<F> user, String targetOid, QName refType) {
    F userType = user.asObjectable();
    for (AssignmentType assignmentType : userType.getAssignment()) {
        ObjectReferenceType targetRef = assignmentType.getTargetRef();
        if (targetRef != null) {
            if (refType.equals(targetRef.getType())) {
                if (targetOid.equals(targetRef.getOid())) {
                    return assignmentType;
                }
            }
        }
    }
    AssertJUnit.fail(user + " does not have assigned " + refType.getLocalPart() + " " + targetOid);
    // not reachable
    return null;
}
Also used : ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)

Example 37 with UserType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType in project midpoint by Evolveum.

the class JAXBUtilTest method testUnmarshallerUtf.

@Test
public void testUnmarshallerUtf() throws JAXBException, SchemaException, FileNotFoundException {
    // GIVEN
    UserType user = JaxbTestUtil.getInstance().unmarshalElement(new File("src/test/resources/util/user-utf8.xml"), UserType.class).getValue();
    // WHEN
    PolyStringType fullName = user.getFullName();
    // THEN
    assertTrue("National characters incorrectly decoded", "Jožko Nováčik".equals(fullName.getOrig()));
}
Also used : PolyStringType(com.evolveum.prism.xml.ns._public.types_3.PolyStringType) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) File(java.io.File) Test(org.testng.annotations.Test)

Example 38 with UserType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType in project midpoint by Evolveum.

the class CredentialPolicyEvaluator method getObjectValuePolicyEvaluator.

private ObjectValuePolicyEvaluator getObjectValuePolicyEvaluator() {
    if (objectValuePolicyEvaluator == null) {
        PrismObject<UserType> user = getUser();
        objectValuePolicyEvaluator = new ObjectValuePolicyEvaluator();
        objectValuePolicyEvaluator.setNow(now);
        objectValuePolicyEvaluator.setObject(user);
        objectValuePolicyEvaluator.setProtector(protector);
        objectValuePolicyEvaluator.setSecurityPolicy(getSecurityPolicy());
        objectValuePolicyEvaluator.setShortDesc(getCredentialHumanReadableName() + " for " + user);
        objectValuePolicyEvaluator.setTask(task);
        objectValuePolicyEvaluator.setValueItemPath(getCredentialValuePath());
        objectValuePolicyEvaluator.setValuePolicyProcessor(valuePolicyProcessor);
        PrismContainer<R> currentCredentialContainer = getOldCredentialContainer();
        if (currentCredentialContainer != null) {
            objectValuePolicyEvaluator.setOldCredentialType(currentCredentialContainer.getRealValue());
        }
    }
    return objectValuePolicyEvaluator;
}
Also used : ObjectValuePolicyEvaluator(com.evolveum.midpoint.model.common.stringpolicy.ObjectValuePolicyEvaluator) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)

Example 39 with UserType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType in project midpoint by Evolveum.

the class CorrelationConfirmationEvaluator method matchUserCorrelationRule.

public <F extends FocusType> boolean matchUserCorrelationRule(Class<F> focusType, PrismObject<ShadowType> currentShadow, PrismObject<F> userType, ObjectSynchronizationType synchronization, ResourceType resourceType, SystemConfigurationType configurationType, Task task, OperationResult result) {
    if (synchronization == null) {
        LOGGER.warn("Resource does not support synchronization. Skipping evaluation correlation/confirmation for  {} and  {}", userType, currentShadow);
        return false;
    }
    List<ConditionalSearchFilterType> conditionalFilters = synchronization.getCorrelation();
    try {
        for (ConditionalSearchFilterType conditionalFilter : conditionalFilters) {
            if (matchUserCorrelationRule(focusType, currentShadow, userType, resourceType, configurationType, conditionalFilter, task, result)) {
                LOGGER.debug("SYNCHRONIZATION: CORRELATION: expression for {} match user: {}", currentShadow, userType);
                return true;
            }
        }
    } catch (SchemaException ex) {
        throw new SystemException("Failed to match user using correlation rule. " + ex.getMessage(), ex);
    }
    LOGGER.debug("SYNCHRONIZATION: CORRELATION: expression for {} does not match user: {}", new Object[] { currentShadow, userType });
    return false;
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) SystemException(com.evolveum.midpoint.util.exception.SystemException) ConditionalSearchFilterType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConditionalSearchFilterType)

Example 40 with UserType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType in project midpoint by Evolveum.

the class FocusValidityScannerTaskHandler method createQuery.

@Override
protected ObjectQuery createQuery(AbstractScannerResultHandler<UserType> handler, TaskRunResult runResult, Task coordinatorTask, OperationResult opResult) throws SchemaException {
    initProcessedOids(coordinatorTask);
    ObjectQuery query = new ObjectQuery();
    ObjectFilter filter;
    PrismObjectDefinition<UserType> focusObjectDef = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(UserType.class);
    XMLGregorianCalendar lastScanTimestamp = handler.getLastScanTimestamp();
    XMLGregorianCalendar thisScanTimestamp = handler.getThisScanTimestamp();
    if (lastScanTimestamp == null) {
        filter = QueryBuilder.queryFor(FocusType.class, prismContext).item(F_ACTIVATION, F_VALID_FROM).le(thisScanTimestamp).or().item(F_ACTIVATION, F_VALID_TO).le(thisScanTimestamp).or().exists(F_ASSIGNMENT).block().item(AssignmentType.F_ACTIVATION, F_VALID_FROM).le(thisScanTimestamp).or().item(AssignmentType.F_ACTIVATION, F_VALID_TO).le(thisScanTimestamp).endBlock().buildFilter();
    } else {
        filter = QueryBuilder.queryFor(FocusType.class, prismContext).item(F_ACTIVATION, F_VALID_FROM).gt(lastScanTimestamp).and().item(F_ACTIVATION, F_VALID_FROM).le(thisScanTimestamp).or().item(F_ACTIVATION, F_VALID_TO).gt(lastScanTimestamp).and().item(F_ACTIVATION, F_VALID_TO).le(thisScanTimestamp).or().exists(F_ASSIGNMENT).block().item(AssignmentType.F_ACTIVATION, F_VALID_FROM).gt(lastScanTimestamp).and().item(AssignmentType.F_ACTIVATION, F_VALID_FROM).le(thisScanTimestamp).or().item(AssignmentType.F_ACTIVATION, F_VALID_TO).gt(lastScanTimestamp).and().item(AssignmentType.F_ACTIVATION, F_VALID_TO).le(thisScanTimestamp).endBlock().buildFilter();
    }
    query.setFilter(filter);
    return query;
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) ObjectFilter(com.evolveum.midpoint.prism.query.ObjectFilter) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)

Aggregations

UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)1275 Test (org.testng.annotations.Test)1093 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1079 Task (com.evolveum.midpoint.task.api.Task)962 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)403 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)379 AbstractInitializedModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)235 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)227 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)224 ArrayList (java.util.ArrayList)138 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)115 DummyAccount (com.evolveum.icf.dummy.resource.DummyAccount)114 PrismObject (com.evolveum.midpoint.prism.PrismObject)88 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)88 AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)85 TestValidityRecomputeTask (com.evolveum.midpoint.model.intest.sync.TestValidityRecomputeTask)77 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)77 QName (javax.xml.namespace.QName)66 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)64 PrismPropertyDefinition (com.evolveum.midpoint.prism.PrismPropertyDefinition)63