use of org.apache.syncope.core.provisioning.api.WorkflowResult in project syncope by apache.
the class DefaultUserWorkflowAdapter method doActivate.
@Override
protected WorkflowResult<String> doActivate(final User user, final String token) {
if (!user.checkToken(token)) {
throw new WorkflowException(new IllegalArgumentException("Wrong token: " + token + " for " + user));
}
user.removeToken();
user.setStatus("active");
User updated = userDAO.save(user);
return new WorkflowResult<>(updated.getKey(), null, "activate");
}
use of org.apache.syncope.core.provisioning.api.WorkflowResult in project syncope by apache.
the class DefaultUserWorkflowAdapter method doCreate.
@Override
protected WorkflowResult<Pair<String, Boolean>> doCreate(final UserTO userTO, final boolean disablePwdPolicyCheck, final Boolean enabled, final boolean storePassword) {
User user = entityFactory.newEntity(User.class);
dataBinder.create(user, userTO, storePassword);
// this will make UserValidator 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);
PropagationByResource propByRes = new PropagationByResource();
propByRes.set(ResourceOperation.CREATE, userDAO.findAllResourceKeys(user.getKey()));
return new WorkflowResult<>(Pair.of(user.getKey(), propagateEnable), propByRes, "create");
}
Aggregations