(request, domain, app_id=None)
return _process_form(
        request=request,
        domain=domain,
        app_id=app_id,
        user_id=None,
        authenticated=False,
        auth_cls=WaivedAuthContext,
    )
This is explicitly called for a submission that has secure submissions enabled, but is manually
    overriding the submit URL to not specify auth context. It appears to be used by demo mode.

    It mainly just checks that we are touching test data only in the right domain and submitting
    as demo_user.
This is explicitly called for a submission that has secure submissions enabled, but is manually
    overriding the submit URL to not specify auth context. It appears to be used by demo mode.
This is explicitly called for a submission that has secure submissions enabled but is manually overriding the submit URL to not specify auth context . It appears to be used by demo mode .
def _noauth_post(request, domain, app_id=None):
    """
    This is explicitly called for a submission that has secure submissions enabled, but is manually
    overriding the submit URL to not specify auth context. It appears to be used by demo mode.

    It mainly just checks that we are touching test data only in the right domain and submitting
    as demo_user.
    """
    try:
        instance, _ = couchforms.get_instance_and_attachment(request)
    except BadSubmissionRequest as e:
        return HttpResponseBadRequest(e.message)

    form_json = convert_xform_to_json(instance)
    case_updates = get_case_updates(form_json)

    def form_ok(form_json):
        return (from_demo_user(form_json) or is_device_report(form_json))

    def case_block_ok(case_updates):
        """
        Check for all cases that we are submitting as demo_user and that the domain we
        are submitting against for any previously existing cases matches the submission
        domain.
        """
        allowed_ids = ('demo_user', 'demo_user_group_id', None)
        case_ids = set()
        for case_update in case_updates:
            case_ids.add(case_update.id)
            create_action = case_update.get_create_action()
            update_action = case_update.get_update_action()
            index_action = case_update.get_index_action()
            if create_action:
                if create_action.user_id not in allowed_ids:
                    return False
                if create_action.owner_id not in allowed_ids:
                    return False
            if update_action:
                if update_action.owner_id not in allowed_ids:
                    return False
            if index_action:
                for index in index_action.indices:
                    case_ids.add(index.referenced_id)

        # todo: consider whether we want to remove this call, and/or pass the result
        # through to the next function so we don't have to get the cases again later
        cases = CaseAccessors(domain).get_cases(list(case_ids))
        for case in cases:
            if case.domain != domain:
                return False
            if case.owner_id or case.user_id not in allowed_ids:
                return False
        return True

    if not (form_ok(form_json) and case_block_ok(case_updates)):
        if request.GET.get('submit_mode') != DEMO_SUBMIT_MODE:
            # invalid submissions under demo mode submission can be processed
            return HttpResponseForbidden()

    return _process_form(
        request=request,
        domain=domain,
        app_id=app_id,
        user_id=None,
        authenticated=False,
        auth_cls=WaivedAuthContext,
    )
def _noauth_post ( request , domain , app_id = None ) : try : instance , _ = couchforms . get_instance_and_attachment ( request ) except BadSubmissionRequest as e : return HttpResponseBadRequest ( e . message ) form_json = convert_xform_to_json ( instance ) case_updates = get_case_updates ( form_json ) def form_ok ( form_json ) : return ( from_demo_user ( form_json ) or is_device_report ( form_json ) ) def case_block_ok ( case_updates ) : """
        Check for all cases that we are submitting as demo_user and that the domain we
        are submitting against for any previously existing cases matches the submission
        domain.
        """ allowed_ids = ( 'demo_user' , 'demo_user_group_id' , None ) case_ids = set ( ) for case_update in case_updates : case_ids . add ( case_update . id ) create_action = case_update . get_create_action ( ) update_action = case_update . get_update_action ( ) index_action = case_update . get_index_action ( ) if create_action : if create_action . user_id not in allowed_ids : return False if create_action . owner_id not in allowed_ids : return False if update_action : if update_action . owner_id not in allowed_ids : return False if index_action : for index in index_action . indices : case_ids . add ( index . referenced_id ) # todo: consider whether we want to remove this call, and/or pass the result # through to the next function so we don't have to get the cases again later cases = CaseAccessors ( domain ) . get_cases ( list ( case_ids ) ) for case in cases : if case . domain != domain : return False if case . owner_id or case . user_id not in allowed_ids : return False return True if not ( form_ok ( form_json ) and case_block_ok ( case_updates ) ) : if request . GET . get ( 'submit_mode' ) != DEMO_SUBMIT_MODE : # invalid submissions under demo mode submission can be processed return HttpResponseForbidden ( ) return _process_form ( request = request , domain = domain , app_id = app_id , user_id = None , authenticated = False , auth_cls = WaivedAuthContext , )