processInstance = runtimeService.startProcessInstanceByKey("userWorkflow", variables);
} catch (ActivitiException e) {
throw new WorkflowException(e);
}
SyncopeUser user = (SyncopeUser) runtimeService.getVariable(processInstance.getProcessInstanceId(),
SYNCOPE_USER);
// this will make SyncopeUserValidator not to consider
// password policies at all
if (disablePwdPolicyCheck) {
user.removeClearPassword();
}
updateStatus(user);
user = userDAO.save(user);
Boolean propagateEnable = (Boolean) runtimeService.getVariable(processInstance.getProcessInstanceId(),
PROPAGATE_ENABLE);
if (propagateEnable == null) {
propagateEnable = enabled;
}
// save resources to be propagated and password for later -
// after form submission - propagation
PropagationByResource propByRes = new PropagationByResource();
propByRes.set(PropagationOperation.CREATE, user.getResourceNames());
if (waitingForForm(user)) {
runtimeService.setVariable(processInstance.getProcessInstanceId(), PROP_BY_RESOURCE, propByRes);
propByRes = null;
if (StringUtils.isNotBlank(userTO.getPassword())) {
runtimeService.setVariable(
processInstance.getProcessInstanceId(), ENCRYPTED_PWD, encrypt(userTO.getPassword()));
}
}
return new WorkflowResult<Map.Entry<Long, Boolean>>(new DefaultMapEntry(user.getId(), propagateEnable),
propByRes, getPerformedTasks(user));
}