use of org.apache.syncope.common.lib.patch.DeassociationPatch in project syncope by apache.
the class UserITCase method unlink.
@Test
public void unlink() {
UserTO userTO = getUniqueSampleTO("unlink@syncope.apache.org");
userTO.getResources().clear();
userTO.getMemberships().clear();
userTO.getVirAttrs().clear();
userTO.getAuxClasses().add("csv");
userTO.getResources().add(RESOURCE_NAME_CSV);
UserTO actual = createUser(userTO).getEntity();
assertNotNull(actual);
assertNotNull(resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey()));
DeassociationPatch deassociationPatch = new DeassociationPatch.Builder().key(actual.getKey()).action(ResourceDeassociationAction.UNLINK).resource(RESOURCE_NAME_CSV).build();
assertNotNull(userService.deassociate(deassociationPatch).readEntity(BulkActionResult.class));
actual = userService.read(actual.getKey());
assertNotNull(actual);
assertTrue(actual.getResources().isEmpty());
assertNotNull(resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey()));
}
use of org.apache.syncope.common.lib.patch.DeassociationPatch in project syncope by apache.
the class AbstractAnyRestClient method unlink.
public BulkActionResult unlink(final String etag, final String key, final List<StatusBean> statuses) {
BulkActionResult result;
synchronized (this) {
AnyService<?> service = getService(etag, getAnyServiceClass());
DeassociationPatch deassociationPatch = new DeassociationPatch.Builder().key(key).action(ResourceDeassociationAction.UNLINK).resources(StatusUtils.buildStatusPatch(statuses).getResources()).build();
result = service.deassociate(deassociationPatch).readEntity(BulkActionResult.class);
resetClient(getAnyServiceClass());
}
return result;
}
use of org.apache.syncope.common.lib.patch.DeassociationPatch in project syncope by apache.
the class AbstractAnyRestClient method unassign.
public BulkActionResult unassign(final String etag, final String key, final List<StatusBean> statuses) {
BulkActionResult result;
synchronized (this) {
AnyService<?> service = getService(etag, getAnyServiceClass());
DeassociationPatch deassociationPatch = new DeassociationPatch.Builder().key(key).action(ResourceDeassociationAction.UNASSIGN).resources(StatusUtils.buildStatusPatch(statuses).getResources()).build();
result = service.deassociate(deassociationPatch).readEntity(BulkActionResult.class);
resetClient(getAnyServiceClass());
}
return result;
}
Aggregations