@PreAuthorize("hasRole('ROLE_UPDATE')")
@RequestMapping(method = RequestMethod.POST, value = "/update")
public RoleTO update(@RequestBody final RoleMod roleMod) {
LOG.debug("Role update called with {}", roleMod);
SyncopeRole role = binder.getRoleFromId(roleMod.getId());
WorkflowResult<Long> updated = rwfAdapter.update(roleMod);
List<PropagationTask> tasks = propagationManager.getRoleUpdateTaskIds(updated,
roleMod.getVirtualAttributesToBeRemoved(), roleMod.getVirtualAttributesToBeUpdated());
final List<PropagationStatusTO> propagations = new ArrayList<PropagationStatusTO>();
taskExecutor.execute(tasks, new DefaultPropagationHandler(connObjectUtil, propagations));
final RoleTO updatedTO = binder.getRoleTO(updated.getResult());
updatedTO.setPropagationStatusTOs(propagations);
auditManager.audit(Category.role, RoleSubCategory.update, Result.success,
"Successfully updated role: " + role.getId());
LOG.debug("About to return updated role\n{}", updatedTO);
return updatedTO;
}