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;
}
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()));
}
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;
}
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;
}
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;
}
Aggregations