use of org.apache.syncope.common.lib.to.PropagationStatus in project syncope by apache.
the class AnyObjectLogic method provision.
@Override
public ProvisioningResult<AnyObjectTO> provision(final String key, final Collection<String> resources, final boolean changePwd, final String password, final boolean nullPriorityAsync) {
// security checks
AnyObjectTO anyObjectTO = binder.getAnyObjectTO(key);
Set<String> effectiveRealms = RealmUtils.getEffective(AuthContextUtils.getAuthorizations().get(AnyEntitlement.UPDATE.getFor(anyObjectTO.getType())), anyObjectTO.getRealm());
securityChecks(effectiveRealms, anyObjectTO.getRealm(), anyObjectTO.getKey());
List<PropagationStatus> statuses = provisioningManager.provision(key, resources, nullPriorityAsync);
ProvisioningResult<AnyObjectTO> result = new ProvisioningResult<>();
result.setEntity(binder.getAnyObjectTO(key));
result.getPropagationStatuses().addAll(statuses);
return result;
}
use of org.apache.syncope.common.lib.to.PropagationStatus in project syncope by apache.
the class DefaultPropagationReporter method onSuccessOrNonPriorityResourceFailures.
@Override
public void onSuccessOrNonPriorityResourceFailures(final PropagationTaskTO taskTO, final PropagationTaskExecStatus executionStatus, final String failureReason, final ConnectorObject beforeObj, final ConnectorObject afterObj) {
PropagationStatus status = new PropagationStatus();
status.setResource(taskTO.getResource());
status.setStatus(executionStatus);
status.setFailureReason(failureReason);
if (beforeObj != null) {
status.setBeforeObj(ConnObjectUtils.getConnObjectTO(beforeObj));
}
if (afterObj != null) {
status.setAfterObj(ConnObjectUtils.getConnObjectTO(afterObj));
}
add(status);
}
use of org.apache.syncope.common.lib.to.PropagationStatus in project syncope by apache.
the class DefaultPropagationReporter method onPriorityResourceFailure.
@Override
public void onPriorityResourceFailure(final String failingResource, final Collection<PropagationTaskTO> tasks) {
LOG.debug("Propagation error: {} priority resource failed to propagate", failingResource);
Optional<PropagationTaskTO> propagationTask = tasks.stream().filter(task -> task.getResource().equals(failingResource)).findFirst();
if (propagationTask.isPresent()) {
PropagationStatus status = new PropagationStatus();
status.setResource(propagationTask.get().getResource());
status.setStatus(PropagationTaskExecStatus.FAILURE);
status.setFailureReason("Propagation error: " + failingResource + " priority resource failed to propagate.");
add(status);
} else {
LOG.error("Could not find {} for {}", PropagationTask.class.getName(), failingResource);
}
}
use of org.apache.syncope.common.lib.to.PropagationStatus in project syncope by apache.
the class UserRestClient method suspend.
public BulkActionResult suspend(final String etag, final String userKey, final List<StatusBean> statuses) {
StatusPatch statusPatch = StatusUtils.buildStatusPatch(statuses, false);
statusPatch.setKey(userKey);
statusPatch.setType(StatusPatchType.SUSPEND);
BulkActionResult result;
synchronized (this) {
result = new BulkActionResult();
Map<String, BulkActionResult.Status> res = result.getResults();
UserService service = getService(etag, UserService.class);
@SuppressWarnings("unchecked") ProvisioningResult<UserTO> provisions = (ProvisioningResult<UserTO>) service.status(statusPatch).readEntity(ProvisioningResult.class);
if (statusPatch.isOnSyncope()) {
res.put(StringUtils.capitalize(Constants.SYNCOPE), "suspended".equalsIgnoreCase(provisions.getEntity().getStatus()) ? BulkActionResult.Status.SUCCESS : BulkActionResult.Status.FAILURE);
}
for (PropagationStatus status : provisions.getPropagationStatuses()) {
res.put(status.getResource(), BulkActionResult.Status.valueOf(status.getStatus().name()));
}
resetClient(UserService.class);
}
return result;
}
use of org.apache.syncope.common.lib.to.PropagationStatus in project syncope by apache.
the class UserLogic method deprovision.
@PreAuthorize("hasRole('" + StandardEntitlement.USER_UPDATE + "')")
@Override
public ProvisioningResult<UserTO> deprovision(final String key, final Collection<String> resources, final boolean nullPriorityAsync) {
// security checks
UserTO user = binder.getUserTO(key);
Set<String> effectiveRealms = RealmUtils.getEffective(AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_UPDATE), user.getRealm());
securityChecks(effectiveRealms, user.getRealm(), user.getKey());
List<PropagationStatus> statuses = provisioningManager.deprovision(key, resources, nullPriorityAsync);
ProvisioningResult<UserTO> result = new ProvisioningResult<>();
result.setEntity(binder.returnUserTO(binder.getUserTO(key)));
result.getPropagationStatuses().addAll(statuses);
return result;
}
Aggregations