use of com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType in project midpoint by Evolveum.
the class TestUserTemplate method test000Sanity.
@Test
public void test000Sanity() throws Exception {
final String TEST_NAME = "test000Sanity";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(TestUserTemplate.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// WHEN
TestUtil.displayWhen(TEST_NAME);
PrismObject<SystemConfigurationType> systemConfiguration = modelService.getObject(SystemConfigurationType.class, SystemObjectsType.SYSTEM_CONFIGURATION.value(), null, task, result);
// THEN
result.computeStatus();
TestUtil.assertSuccess(result);
display("System config", systemConfiguration);
assertNotNull("no system config", systemConfiguration);
List<ObjectPolicyConfigurationType> defaultObjectPolicyConfiguration = systemConfiguration.asObjectable().getDefaultObjectPolicyConfiguration();
assertNotNull("No object policy", defaultObjectPolicyConfiguration);
assertEquals("Wrong object policy size", 2, defaultObjectPolicyConfiguration.size());
assertObjectTemplate(defaultObjectPolicyConfiguration, UserType.COMPLEX_TYPE, null, USER_TEMPLATE_COMPLEX_OID);
assertObjectTemplate(defaultObjectPolicyConfiguration, UserType.COMPLEX_TYPE, EMPLOYEE_TYPE_MAROONED, USER_TEMPLATE_MAROONED_OID);
assertRoles(NUMBER_OF_ROLES);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType in project midpoint by Evolveum.
the class ConfirmationNotifier method createConfirmationLink.
protected String createConfirmationLink(UserType userType, GeneralNotifierType generalNotifierType, OperationResult result) {
ConfirmationNotifierType userRegistrationNotifier = (ConfirmationNotifierType) generalNotifierType;
RegistrationConfirmationMethodType confirmationMethod = userRegistrationNotifier.getConfirmationMethod();
if (confirmationMethod == null) {
return null;
}
ExpressionEnvironment expressionEnv = new ExpressionEnvironment();
expressionEnv.setCurrentResult(result);
ModelExpressionThreadLocalHolder.pushExpressionEnvironment(expressionEnv);
try {
switch(confirmationMethod) {
case LINK:
// SystemConfigurationType systemConfiguration = notificationsUtil.getSystemConfiguration(result);
// if (systemConfiguration == null) {
// LOGGER.trace("No system configuration defined. Skipping link generation.");
// return null;
// }
//// String defaultHostname = SystemConfigurationTypeUtil.getDefaultHostname(systemConfiguration);
String confirmationLink = getConfirmationLink(userType);
return confirmationLink;
case PIN:
throw new UnsupportedOperationException("PIN confirmation not supported yes");
// return getNonce(userType);
default:
break;
}
} finally {
ModelExpressionThreadLocalHolder.popExpressionEnvironment();
}
return null;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType in project midpoint by Evolveum.
the class ModelUtils method determineObjectPolicyConfiguration.
public static <O extends ObjectType> ObjectPolicyConfigurationType determineObjectPolicyConfiguration(Class<O> objectClass, List<String> objectSubtypes, SystemConfigurationType systemConfigurationType) throws ConfigurationException {
ObjectPolicyConfigurationType applicablePolicyConfigurationType = null;
for (ObjectPolicyConfigurationType aPolicyConfigurationType : systemConfigurationType.getDefaultObjectPolicyConfiguration()) {
QName typeQName = aPolicyConfigurationType.getType();
ObjectTypes objectType = ObjectTypes.getObjectTypeFromTypeQName(typeQName);
if (objectType == null) {
throw new ConfigurationException("Unknown type " + typeQName + " in default object policy definition in system configuration");
}
if (objectType.getClassDefinition() == objectClass) {
String aSubType = aPolicyConfigurationType.getSubtype();
if (aSubType == null) {
if (applicablePolicyConfigurationType == null) {
applicablePolicyConfigurationType = aPolicyConfigurationType;
}
} else if (objectSubtypes != null && objectSubtypes.contains(aSubType)) {
applicablePolicyConfigurationType = aPolicyConfigurationType;
}
}
}
if (applicablePolicyConfigurationType != null) {
return applicablePolicyConfigurationType;
}
// Deprecated
for (ObjectPolicyConfigurationType aPolicyConfigurationType : systemConfigurationType.getObjectTemplate()) {
QName typeQName = aPolicyConfigurationType.getType();
ObjectTypes objectType = ObjectTypes.getObjectTypeFromTypeQName(typeQName);
if (objectType == null) {
throw new ConfigurationException("Unknown type " + typeQName + " in object template definition in system configuration");
}
if (objectType.getClassDefinition() == objectClass) {
return aPolicyConfigurationType;
}
}
// Deprecated method to specify user template. For compatibility only
if (objectClass == UserType.class) {
ObjectReferenceType templateRef = systemConfigurationType.getDefaultUserTemplateRef();
if (templateRef == null) {
return null;
}
ObjectPolicyConfigurationType policy = new ObjectPolicyConfigurationType();
policy.setObjectTemplateRef(templateRef.clone());
return policy;
}
return null;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType in project midpoint by Evolveum.
the class ObjectMerger method computeMergeDeltas.
public <O extends ObjectType> MergeDeltas<O> computeMergeDeltas(Class<O> type, String leftOid, String rightOid, final String mergeConfigurationName, final Task task, final OperationResult result) throws ObjectNotFoundException, SchemaException, ConfigurationException, ExpressionEvaluationException, CommunicationException, SecurityViolationException {
final PrismObject<O> objectLeft = (PrismObject<O>) objectResolver.getObjectSimple(type, leftOid, null, task, result).asPrismObject();
final PrismObject<O> objectRight = (PrismObject<O>) objectResolver.getObjectSimple(type, rightOid, null, task, result).asPrismObject();
PrismObject<SystemConfigurationType> systemConfiguration = systemObjectCache.getSystemConfiguration(result);
MergeConfigurationType mergeConfiguration = selectConfiguration(systemConfiguration, mergeConfigurationName);
if (mergeConfiguration == null) {
throw new ConfigurationException("No merge configuration defined");
}
// The "left" object is always the one that will be the result. We will use its OID.
final ObjectDelta<O> leftObjectDelta = objectLeft.createModifyDelta();
final ObjectDelta<O> leftLinkDelta = objectLeft.createModifyDelta();
final ObjectDelta<O> rightLinkDelta = objectRight.createModifyDelta();
final List<ItemPath> processedPaths = new ArrayList<>();
computeItemDeltas(leftObjectDelta, objectLeft, objectRight, processedPaths, mergeConfiguration, mergeConfigurationName, task, result);
computeDefaultDeltas(leftObjectDelta, objectLeft, objectRight, processedPaths, mergeConfiguration, mergeConfigurationName, task, result);
computeProjectionDeltas(leftLinkDelta, rightLinkDelta, objectLeft, objectRight, mergeConfiguration, mergeConfigurationName, task, result);
return new MergeDeltas<>(leftObjectDelta, leftLinkDelta, rightLinkDelta);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType in project midpoint by Evolveum.
the class SchemaTransformer method determineObjectTemplate.
public <O extends ObjectType> ObjectTemplateType determineObjectTemplate(PrismObject<O> object, AuthorizationPhaseType phase, OperationResult result) throws SchemaException, ConfigurationException, ObjectNotFoundException {
PrismObject<SystemConfigurationType> systemConfiguration = systemObjectCache.getSystemConfiguration(result);
if (systemConfiguration == null) {
return null;
}
ObjectPolicyConfigurationType objectPolicyConfiguration = ModelUtils.determineObjectPolicyConfiguration(object, systemConfiguration.asObjectable());
if (objectPolicyConfiguration == null) {
return null;
}
ObjectReferenceType objectTemplateRef = objectPolicyConfiguration.getObjectTemplateRef();
if (objectTemplateRef == null) {
return null;
}
PrismObject<ObjectTemplateType> template = cacheRepositoryService.getObject(ObjectTemplateType.class, objectTemplateRef.getOid(), null, result);
return template.asObjectable();
}
Aggregations