@Override
public WorkflowResult<Map.Entry<Long, Boolean>> create(final UserTO userTO, final boolean disablePwdPolicyCheck,
final Boolean enabled)
throws WorkflowException {
SyncopeUser user = new SyncopeUser();
dataBinder.create(user, userTO);
// this will make SyncopeUserValidator not to consider password policies at all
if (disablePwdPolicyCheck) {
user.removeClearPassword();
}
String status;
boolean propagateEnable;
if (enabled == null) {
status = "created";
propagateEnable = true;
} else {
status = enabled
? "active"
: "suspended";
propagateEnable = enabled;
user.setSuspended(!enabled);
}
user.setStatus(status);
user = userDAO.save(user);
final PropagationByResource propByRes = new PropagationByResource();
propByRes.set(ResourceOperation.CREATE, user.getResourceNames());
return new WorkflowResult<Map.Entry<Long, Boolean>>(new SimpleEntry<Long, Boolean>(user.getId(),
propagateEnable), propByRes, "create");
}