Example #1
0
File: api.py Project: yaoqi/sentry
    def _dispatch(self, request, helper, sentry_key, project_id=None, origin=None, *args, **kwargs):
        if request.method != 'POST':
            track_outcome(0, 0, None, Outcome.INVALID, "disallowed_method")
            return HttpResponseNotAllowed(['POST'])

        content_type = request.META.get('CONTENT_TYPE')
        if content_type is None or not content_type.startswith(self.content_types):
            track_outcome(0, 0, None, Outcome.INVALID, "content_type")
            raise APIError('Invalid Content-Type')

        request.user = AnonymousUser()

        project = self._get_project_from_id(project_id)
        helper.context.bind_project(project)

        auth = Auth({'sentry_key': sentry_key}, is_public=False)
        auth.client = 'sentry.unreal_engine'

        key = helper.project_key_from_auth(auth)
        if key.project_id != project.id:
            track_outcome(
                project.organization_id,
                project.id,
                None,
                Outcome.INVALID,
                "multi_project_id")
            raise APIError('Two different projects were specified')

        helper.context.bind_auth(auth)
        return super(APIView, self).dispatch(
            request=request, project=project, auth=auth, helper=helper, key=key, **kwargs
        )
Example #2
0
    def _dispatch(self,
                  request,
                  helper,
                  sentry_key,
                  project_id=None,
                  origin=None,
                  *args,
                  **kwargs):
        if request.method != 'POST':
            return HttpResponseNotAllowed(['POST'])

        content_type = request.META.get('CONTENT_TYPE')
        if content_type is None or not content_type.startswith(
                self.content_types):
            raise APIError('Invalid Content-Type')

        request.user = AnonymousUser()

        project = self._get_project_from_id(project_id)
        helper.context.bind_project(project)

        auth = Auth({'sentry_key': sentry_key}, is_public=False)
        auth.client = 'sentry.unreal_engine'

        key = helper.project_key_from_auth(auth)
        if key.project_id != project.id:
            raise APIError('Two different projects were specified')

        helper.context.bind_auth(auth)
        return super(APIView, self).dispatch(request=request,
                                             project=project,
                                             auth=auth,
                                             helper=helper,
                                             key=key,
                                             **kwargs)
Example #3
0
    def _dispatch(self, request, helper, project_config, sentry_key, origin=None,
                  config_flags=None, *args, **kwargs):
        if request.method != 'POST':
            track_outcome(0, 0, None, Outcome.INVALID, "disallowed_method")
            return HttpResponseNotAllowed(['POST'])

        content_type = request.META.get('CONTENT_TYPE')
        if content_type is None or not content_type.startswith(self.content_types):
            track_outcome(0, 0, None, Outcome.INVALID, "content_type")
            raise APIError('Invalid Content-Type')

        request.user = AnonymousUser()

        project = project_config.project
        project_id = project_config.project_id

        auth = Auth(public_key=sentry_key, is_public=False)
        auth.client = 'sentry.unreal_engine'

        key = helper.project_key_from_auth(auth)
        if key.project_id != project_id:
            track_outcome(
                project_config.organization_id,
                project_id,
                None,
                Outcome.INVALID,
                "multi_project_id")
            raise APIError('Two different projects were specified')

        helper.context.bind_auth(auth)
        return super(APIView, self).dispatch(
            request=request, project=project, auth=auth, helper=helper, key=key, project_config=project_config, **kwargs
        )