List<Group> selectedGroups;
try {
selectedGroups = branchService.getPermissionGroupsFor(forumId, permissionInfo.getBranchId(),
permissionInfo.isAllowed(), branchPermission);
} catch (NotFoundException e) {
return new JsonResponse(JsonResponseStatus.FAIL, null);
}
List<GroupDto> alreadySelected = GroupDto.convertGroupList(selectedGroups, true);
List<Group> availableGroups = permissionManager.getAllGroupsWithoutExcluded(selectedGroups, branchPermission);
List<GroupDto> available = GroupDto.convertGroupList(availableGroups, true);
permission.setSelectedGroups(alreadySelected);
permission.setAvailableGroups(available);
return new JsonResponse(JsonResponseStatus.SUCCESS, permission);
}