def METHOD_NAME(groups: list[str]) -> Response:
    """
    Remove the current user from the groups.
    The groups must have self-remove enabled via document settings.
    :param groups: List of groups to leave from.
    :return: JSON response with list of left groups and possible status message.
    """
    verify_logged_in()
    current_user = get_current_user_object()
    def do_leave(user: User, group: UserGroup) -> None:
        membership: UserGroupMember = user.active_memberships.get(group.id)
        membership.set_expired()
    all_ok, _, result = _do_group_op(
        groups, current_user, "leave", True, lambda i: i.canLeave, do_leave
    )
    db.session.commit()
    return json_response({"ok": all_ok, "result": result})