def dispatch(self, request_type, request, **kwargs): if not toggles.ODATA.enabled_for_request(request): raise ImmediateHttpResponse( response=HttpResponseNotFound('Feature flag not enabled.')) self.config_id = kwargs['config_id'] with TimingContext() as timer: response = super(ODataFormResource, self).dispatch(request_type, request, **kwargs) record_feed_access_in_datadog(request, self.config_id, timer.duration, response) return response
def dispatch(self, request_type, request, **kwargs): if not domain_has_privilege(request.domain, privileges.ODATA_FEED): raise ImmediateHttpResponse( response=HttpResponseNotFound('Feature flag not enabled.')) self.config_id = kwargs['config_id'] self.table_id = int(kwargs.get('table_id', 0)) with TimingContext() as timer: response = super(BaseODataResource, self).dispatch(request_type, request, **kwargs) record_feed_access_in_datadog(request, self.config_id, timer.duration, response) return response
def dispatch(self, request_type, request, **kwargs): if not BI_INTEGRATION_PREVIEW.enabled_for_request(request): raise ImmediateHttpResponse( response=HttpResponseNotFound('Feature flag not enabled.')) self.config_id = kwargs['config_id'] self.table_id = int(kwargs.get('table_id', 0)) with TimingContext() as timer: response = super(ODataCaseResource, self).dispatch(request_type, request, **kwargs) record_feed_access_in_datadog(request, self.config_id, timer.duration, response) return response
def dispatch(self, request_type, request, **kwargs): if not domain_has_privilege(request.domain, privileges.ODATA_FEED): raise ImmediateHttpResponse( response=HttpResponseNotFound('Feature flag not enabled.')) self.config_id = kwargs['config_id'] self.table_id = int(kwargs.get('table_id', 0)) with TimingContext() as timer: response = super(BaseODataResource, self).dispatch(request_type, request, **kwargs) # order REALLY matters for the following code. It should be called # AFTER the super's dispatch or request.couch_user will not be present if not user_can_view_odata_feed(request.domain, request.couch_user): raise ImmediateHttpResponse(response=HttpResponseNotFound( 'No permission to view feed.')) record_feed_access_in_datadog(request, self.config_id, timer.duration, response) return response