def METHOD_NAME(request, domain, group_id):
    group = Group.get(group_id)
    if group.domain == domain:
        name = request.POST.get('name')
        case_sharing = request.POST.get('case_sharing')
        reporting = request.POST.get('reporting')
        if not name:
            messages.warning(request, _(
                "You tried to remove the group's name, "
                "but every group must have a name so we left it unchanged."
            ))
        elif group.name != name:
            dupe = Group.by_name(domain, name)
            if dupe:
                messages.warning(request, _(
                    "We didn't rename your group because there's already "
                    "another group with that name."
                ))
            else:
                group.name = name
        if case_sharing in ('true', 'false'):
            group.case_sharing = json.loads(case_sharing)
        if reporting in ('true', 'false'):
            group.reporting = json.loads(reporting)
        _ensure_case_sharing_privilege(request, group)
        group.save()
        return HttpResponseRedirect(
            reverse("group_members", args=[domain, group_id])
        )
    else:
        return HttpResponseForbidden()