Source:
<code>private String delete(final Long userId) throws UserRetrievalException, UserManagementException, UserPermissionRetrievalException, JsonProcessingException, EntityCreationException, EntityRetrievalException { if (userId <= 0) { throw new UserRetrievalException("Cannot delete user with ID less than 0"); } UserDTO toDelete = userManager.getById(userId); if (toDelete == null) { throw new UserRetrievalException("Could not find user with id " + userId); } if (resourcePermissions.isUserRoleAdmin() || resourcePermissions.isUserRoleOnc()) { userManager.delete(toDelete); userPermissionsManager.deleteAllAcbPermissionsForUser(userId); userPermissionsManager.deleteAllAtlPermissionsForUser(userId); } else if (resourcePermissions.isUserRoleAcbAdmin()) { List<CertificationBodyDTO> targetUserAcbs = resourcePermissions.getAllAcbsForUser(userId); for (CertificationBodyDTO dto : resourcePermissions.getAllAcbsForCurrentUser()) { if (isAcbInList(dto, targetUserAcbs)) { userPermissionsManager.deleteAcbPermission(dto, userId); } } <START> } else if (resourcePermissions.isUserRoleAtlAdmin()) { <END> List<TestingLabDTO> targetUserAtls = resourcePermissions.getAllAtlsForUser(userId); for (TestingLabDTO dto : resourcePermissions.getAllAtlsForCurrentUser()) { if (isAtlInList(dto, targetUserAtls)) { userPermissionsManager.deleteAtlPermission(dto, userId); } } } String activityDescription = "User " + toDelete.getSubjectName() + " was deleted."; activityManager.addActivity(ActivityConcept.ACTIVITY_CONCEPT_USER, toDelete.getId(), activityDescription, toDelete, null); return "{\"deletedUser\" : true}"; }</code><technical_language>If a user ROLE_ACB ROLE_ATL I this work desired? I super unlikely. if do, I if/else if's need changed a bit</technical_language>

Target:
private String delete(final Long userId) throws UserRetrievalException, UserManagementException, UserPermissionRetrievalException, JsonProcessingException, EntityCreationException, EntityRetrievalException { if (userId <= 0) { throw new UserRetrievalException("Cannot delete user with ID less than 0"); } UserDTO toDelete = userManager.getById(userId); if (toDelete == null) { throw new UserRetrievalException("Could not find user with id " + userId); } if (resourcePermissions.isUserRoleAdmin() || resourcePermissions.isUserRoleOnc()) { userManager.delete(toDelete); userPermissionsManager.deleteAllAcbPermissionsForUser(userId); userPermissionsManager.deleteAllAtlPermissionsForUser(userId); } else { if (resourcePermissions.isUserRoleAcbAdmin()) { List<CertificationBodyDTO> targetUserAcbs = resourcePermissions.getAllAcbsForUser(userId); for (CertificationBodyDTO dto : resourcePermissions.getAllAcbsForCurrentUser()) { if (isAcbInList(dto, targetUserAcbs)) { userPermissionsManager.deleteAcbPermission(dto, userId); } } } if (resourcePermissions.isUserRoleAtlAdmin()) { List<TestingLabDTO> targetUserAtls = resourcePermissions.getAllAtlsForUser(userId); for (TestingLabDTO dto : resourcePermissions.getAllAtlsForCurrentUser()) { if (isAtlInList(dto, targetUserAtls)) { userPermissionsManager.deleteAtlPermission(dto, userId); } } } } String activityDescription = "User " + toDelete.getSubjectName() + " was deleted."; activityManager.addActivity(ActivityConcept.ACTIVITY_CONCEPT_USER, toDelete.getId(), activityDescription, toDelete, null); return "{\"deletedUser\" : true}"; }