use of org.apache.syncope.common.lib.to.ProvisioningResult 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;
}
use of org.apache.syncope.common.lib.to.ProvisioningResult in project syncope by apache.
the class UserLogic method provision.
@PreAuthorize("hasRole('" + StandardEntitlement.USER_UPDATE + "')")
@Override
public ProvisioningResult<UserTO> provision(final String key, final Collection<String> resources, final boolean changePwd, final String password, 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.provision(key, changePwd, password, resources, nullPriorityAsync);
ProvisioningResult<UserTO> result = new ProvisioningResult<>();
result.setEntity(binder.returnUserTO(binder.getUserTO(key)));
result.getPropagationStatuses().addAll(statuses);
return result;
}
use of org.apache.syncope.common.lib.to.ProvisioningResult in project syncope by apache.
the class GroupLogic method provision.
@PreAuthorize("hasRole('" + StandardEntitlement.GROUP_UPDATE + "')")
@Override
public ProvisioningResult<GroupTO> provision(final String key, final Collection<String> resources, final boolean changePwd, final String password, final boolean nullPriorityAsync) {
// security checks
GroupTO group = binder.getGroupTO(key);
Set<String> effectiveRealms = RealmUtils.getEffective(AuthContextUtils.getAuthorizations().get(StandardEntitlement.GROUP_UPDATE), group.getRealm());
securityChecks(effectiveRealms, group.getRealm(), group.getKey());
List<PropagationStatus> statuses = provisioningManager.provision(key, resources, nullPriorityAsync);
ProvisioningResult<GroupTO> result = new ProvisioningResult<>();
result.setEntity(binder.getGroupTO(key));
result.getPropagationStatuses().addAll(statuses);
return result;
}
use of org.apache.syncope.common.lib.to.ProvisioningResult in project syncope by apache.
the class AnyDirectoryPanel method customResultBody.
@Override
@SuppressWarnings("unchecked")
protected Panel customResultBody(final String panelId, final AnyWrapper<A> item, final Serializable result) {
if (!(result instanceof ProvisioningResult)) {
throw new IllegalStateException("Unsupported result type");
}
return new StatusPanel(panelId, ((ProvisioningResult<A>) result).getEntity(), new ListModel<>(new ArrayList<>()), ((ProvisioningResult<A>) result).getPropagationStatuses().stream().map(input -> {
ConnObjectTO before = input.getBeforeObj();
ConnObjectWrapper afterObjWrapper = new ConnObjectWrapper(((ProvisioningResult<A>) result).getEntity(), input.getResource(), input.getAfterObj());
return Pair.of(before, afterObjWrapper);
}).collect(Collectors.toList()), pageRef);
}
use of org.apache.syncope.common.lib.to.ProvisioningResult in project syncope by apache.
the class PlainSchemaITCase method issue259.
@Test
public void issue259() {
PlainSchemaTO schemaTO = buildPlainSchemaTO("schema_issue259", AttrSchemaType.Double);
schemaTO.setUniqueConstraint(true);
schemaTO = createSchema(SchemaType.PLAIN, schemaTO);
assertNotNull(schemaTO);
AnyTypeClassTO typeClass = new AnyTypeClassTO();
typeClass.setKey("issue259");
typeClass.getPlainSchemas().add(schemaTO.getKey());
anyTypeClassService.create(typeClass);
UserTO userTO = UserITCase.getUniqueSampleTO("issue259@syncope.apache.org");
userTO.getAuxClasses().add(typeClass.getKey());
userTO.getPlainAttrs().add(attrTO(schemaTO.getKey(), "1"));
userTO = createUser(userTO).getEntity();
assertNotNull(userTO);
UserTO newUserTO = SerializationUtils.clone(userTO);
newUserTO.getMemberships().add(new MembershipTO.Builder().group("b1f7c12d-ec83-441f-a50e-1691daaedf3b").build());
userTO = userService.update(newUserTO).readEntity(new GenericType<ProvisioningResult<UserTO>>() {
}).getEntity();
assertNotNull(userTO);
}
Aggregations