@Override public Pair<String, List<PropagationStatus>> reactivate( final StatusPatch statusPatch, final boolean nullPriorityAsync) { WorkflowResult<String> updated = statusPatch.isOnSyncope() ? uwfAdapter.reactivate(statusPatch.getKey()) : new WorkflowResult<>(statusPatch.getKey(), null, statusPatch.getType().name().toLowerCase()); return Pair.of(updated.getResult(), propagateStatus(statusPatch, nullPriorityAsync)); }
@Override public Pair<String, List<PropagationStatus>> activate( final StatusPatch statusPatch, final boolean nullPriorityAsync) { WorkflowResult<String> updated = statusPatch.isOnSyncope() ? uwfAdapter.activate(statusPatch.getKey(), statusPatch.getToken()) : new WorkflowResult<>(statusPatch.getKey(), null, statusPatch.getType().name().toLowerCase()); return Pair.of(updated.getResult(), propagateStatus(statusPatch, nullPriorityAsync)); }
public Builder key(final String key) { getInstance().setKey(key); return this; }
protected List<PropagationStatus> propagateStatus( final StatusPatch statusPatch, final boolean nullPriorityAsync) { PropagationByResource propByRes = new PropagationByResource(); propByRes.addAll(ResourceOperation.UPDATE, statusPatch.getResources()); List<PropagationTaskInfo> taskInfos = propagationManager.getUpdateTasks( AnyTypeKind.USER, statusPatch.getKey(), false, statusPatch.getType() != StatusPatchType.SUSPEND, propByRes, null, null); PropagationReporter propagationReporter = taskExecutor.execute(taskInfos, nullPriorityAsync); return propagationReporter.getStatuses(); }
@PreAuthorize("hasRole('" + StandardEntitlement.USER_UPDATE + "')") public ProvisioningResult<UserTO> status(final StatusPatch statusPatch, final boolean nullPriorityAsync) { // security checks UserTO toUpdate = binder.getUserTO(statusPatch.getKey()); Set<String> effectiveRealms = RealmUtils.getEffective( AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_UPDATE), toUpdate.getRealm()); securityChecks(effectiveRealms, toUpdate.getRealm(), toUpdate.getKey()); // ensures the actual user key is effectively on the patch - as the binder.getUserTO(statusPatch.getKey()) // call above works with username as well statusPatch.setKey(toUpdate.getKey()); Pair<String, List<PropagationStatus>> updated = setStatusOnWfAdapter(statusPatch, nullPriorityAsync); return afterUpdate( binder.returnUserTO(binder.getUserTO(updated.getKey())), updated.getRight(), Collections.<LogicActions>emptyList(), false, Collections.<String>emptySet()); }
@Override public Response status(final StatusPatch statusPatch) { Date etagDate = findLastChange(statusPatch.getKey()); checkETag(String.valueOf(etagDate.getTime())); ProvisioningResult<UserTO> updated = logic.status(statusPatch, isNullPriorityAsync()); return modificationResponse(updated); } }
protected Pair<String, List<PropagationStatus>> setStatusOnWfAdapter( final StatusPatch statusPatch, final boolean nullPriorityAsync) { Pair<String, List<PropagationStatus>> updated; switch (statusPatch.getType()) { case SUSPEND: updated = provisioningManager.suspend(statusPatch, nullPriorityAsync); break; case REACTIVATE: updated = provisioningManager.reactivate(statusPatch, nullPriorityAsync); break; case ACTIVATE: default: updated = provisioningManager.activate(statusPatch, nullPriorityAsync); break; } return updated; }
@Override protected StatusPatch newInstance() { return new StatusPatch(); }
propByRes.addAll(ResourceOperation.UPDATE, statusPatch.getResources()); List<PropagationTaskInfo> taskInfos = getPropagationManager().getUpdateTasks( AnyTypeKind.USER, statusPatch.getKey(), false, statusPatch.getType() != StatusPatchType.SUSPEND, propByRes, null,
key = ((UserPatch) args[i]).getKey(); } else if (args[i] instanceof StatusPatch) { key = ((StatusPatch) args[i]).getKey();
@Override public Pair<String, List<PropagationStatus>> suspend( final StatusPatch statusPatch, final boolean nullPriorityAsync) { WorkflowResult<String> updated = statusPatch.isOnSyncope() ? uwfAdapter.suspend(statusPatch.getKey()) : new WorkflowResult<>(statusPatch.getKey(), null, statusPatch.getType().name().toLowerCase()); return Pair.of(updated.getResult(), propagateStatus(statusPatch, nullPriorityAsync)); }
@Override @SuppressWarnings("unchecked") public Pair<String, List<PropagationStatus>> activate( final StatusPatch statusPatch, final boolean nullPriorityAsync) { PollingConsumer pollingConsumer = getConsumer("direct:statusPort"); Map<String, Object> props = new HashMap<>(); props.put("token", statusPatch.getToken()); props.put("key", statusPatch.getKey()); props.put("statusPatch", statusPatch); props.put("nullPriorityAsync", nullPriorityAsync); if (statusPatch.isOnSyncope()) { sendMessage("direct:activateUser", statusPatch.getKey(), props); } else { WorkflowResult<String> updated = new WorkflowResult<>(statusPatch.getKey(), null, statusPatch.getType().name().toLowerCase()); sendMessage("direct:userStatusPropagation", updated, props); } Exchange exchange = pollingConsumer.receive(); if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) { throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT); } return exchange.getIn().getBody(Pair.class); }
@PreAuthorize("isAuthenticated() and not(hasRole('" + StandardEntitlement.MUST_CHANGE_PASSWORD + "'))") public ProvisioningResult<UserTO> selfStatus(final StatusPatch statusPatch, final boolean nullPriorityAsync) { statusPatch.setKey(userDAO.findKey(AuthContextUtils.getUsername())); Pair<String, List<PropagationStatus>> updated = setStatusOnWfAdapter(statusPatch, nullPriorityAsync); return afterUpdate( binder.returnUserTO(binder.getUserTO(updated.getKey())), updated.getRight(), Collections.<LogicActions>emptyList(), false, Collections.<String>emptySet()); }
@Override @SuppressWarnings("unchecked") public Pair<String, List<PropagationStatus>> reactivate( final StatusPatch statusPatch, final boolean nullPriorityAsync) { PollingConsumer pollingConsumer = getConsumer("direct:statusPort"); Map<String, Object> props = new HashMap<>(); props.put("key", statusPatch.getKey()); props.put("statusPatch", statusPatch); props.put("nullPriorityAsync", nullPriorityAsync); if (statusPatch.isOnSyncope()) { sendMessage("direct:reactivateUser", statusPatch.getKey(), props); } else { WorkflowResult<String> updated = new WorkflowResult<>(statusPatch.getKey(), null, statusPatch.getType().name().toLowerCase()); sendMessage("direct:userStatusPropagation", updated, props); } Exchange exchange = pollingConsumer.receive(); if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) { throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT); } return exchange.getIn().getBody(Pair.class); }
@Override @SuppressWarnings("unchecked") public Pair<String, List<PropagationStatus>> suspend( final StatusPatch statusPatch, final boolean nullPriorityAsync) { PollingConsumer pollingConsumer = getConsumer("direct:statusPort"); Map<String, Object> props = new HashMap<>(); props.put("key", statusPatch.getKey()); props.put("statusPatch", statusPatch); props.put("nullPriorityAsync", nullPriorityAsync); if (statusPatch.isOnSyncope()) { sendMessage("direct:suspendUser", statusPatch.getKey(), props); } else { WorkflowResult<String> updated = new WorkflowResult<>(statusPatch.getKey(), null, statusPatch.getType().name().toLowerCase()); sendMessage("direct:userStatusPropagation", updated, props); } Exchange exchange = pollingConsumer.receive(); if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) { throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT); } return exchange.getIn().getBody(Pair.class); }