use of org.apache.syncope.common.lib.to.PropagationStatus in project syncope by apache.
the class GroupLogic method deprovision.
@PreAuthorize("hasRole('" + StandardEntitlement.GROUP_UPDATE + "')")
@Override
public ProvisioningResult<GroupTO> deprovision(final String key, final Collection<String> resources, 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.deprovision(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.PropagationStatus in project syncope by apache.
the class AnyObjectLogic method delete.
@Override
public ProvisioningResult<AnyObjectTO> delete(final String key, final boolean nullPriorityAsync) {
AnyObjectTO anyObject = binder.getAnyObjectTO(key);
Pair<AnyObjectTO, List<LogicActions>> before = beforeDelete(anyObject);
Set<String> effectiveRealms = RealmUtils.getEffective(AuthContextUtils.getAuthorizations().get(AnyEntitlement.DELETE.getFor(before.getLeft().getType())), before.getLeft().getRealm());
securityChecks(effectiveRealms, before.getLeft().getRealm(), before.getLeft().getKey());
List<PropagationStatus> statuses = provisioningManager.delete(before.getLeft().getKey(), nullPriorityAsync);
AnyObjectTO anyObjectTO = new AnyObjectTO();
anyObjectTO.setKey(before.getLeft().getKey());
return afterDelete(anyObjectTO, statuses, before.getRight());
}
use of org.apache.syncope.common.lib.to.PropagationStatus in project syncope by apache.
the class JAXBTest method provisioningResult.
@Test
public void provisioningResult() throws JAXBException {
JAXBContext context = JAXBContext.newInstance(ProvisioningResult.class);
Marshaller marshaller = context.createMarshaller();
Unmarshaller unmarshaller = context.createUnmarshaller();
GroupTO group = new GroupTO();
group.setName(UUID.randomUUID().toString());
group.setRealm(SyncopeConstants.ROOT_REALM);
group.getVirAttrs().add(new AttrTO.Builder().schema("rvirtualdata").value("rvirtualvalue").build());
group.getADynMembershipConds().put("USER", "username==a*");
ProvisioningResult<GroupTO> original = new ProvisioningResult<>();
original.setEntity(group);
PropagationStatus status = new PropagationStatus();
status.setFailureReason("failed");
status.setBeforeObj(new ConnObjectTO());
original.getPropagationStatuses().add(status);
StringWriter writer = new StringWriter();
marshaller.marshal(original, writer);
Object actual = unmarshaller.unmarshal(new StringReader(writer.toString()));
assertEquals(original, actual);
}
use of org.apache.syncope.common.lib.to.PropagationStatus in project syncope by apache.
the class JSONTest method provisioningResult.
@Test
public void provisioningResult() throws IOException {
GroupTO group = new GroupTO();
group.setName(UUID.randomUUID().toString());
group.setRealm(SyncopeConstants.ROOT_REALM);
group.getVirAttrs().add(new AttrTO.Builder().schema("rvirtualdata").value("rvirtualvalue").build());
group.getADynMembershipConds().put("USER", "username==a*");
ProvisioningResult<GroupTO> original = new ProvisioningResult<>();
original.setEntity(group);
PropagationStatus status = new PropagationStatus();
status.setFailureReason("failed");
status.setBeforeObj(new ConnObjectTO());
original.getPropagationStatuses().add(status);
ObjectMapper mapper = new ObjectMapper();
StringWriter writer = new StringWriter();
mapper.writeValue(writer, original);
ProvisioningResult<GroupTO> actual = mapper.readValue(writer.toString(), new TypeReference<ProvisioningResult<GroupTO>>() {
});
assertEquals(original, actual);
}
Aggregations