def oauth_application_detail(auth, **kwargs): """Show detail for a single OAuth application""" client_id = kwargs.get("client_id") # The client ID must be an active and existing record, and the logged-in user must have permission to view it. try: # record = ApiOAuth2Application.find_one(Q("client_id", "eq", client_id)) except NoResultsFound: raise HTTPError(http.NOT_FOUND) if record.owner != auth.user: raise HTTPError(http.FORBIDDEN) if record.is_active is False: raise HTTPError(http.GONE) app_detail_url = api_v2_url("applications/{}/".format(client_id)) # Send request to this URL return {"app_list_url": "", "app_detail_url": app_detail_url}
def oauth_application_detail(auth, **kwargs): """Show detail for a single OAuth application""" client_id = kwargs.get('client_id') # The client ID must be an active and existing record, and the logged-in user must have permission to view it. try: # record = ApiOAuth2Application.find_one(Q('client_id', 'eq', client_id)) except NoResultsFound: raise HTTPError(http.NOT_FOUND) if record.owner != auth.user: raise HTTPError(http.FORBIDDEN) if record.is_active is False: raise HTTPError(http.GONE) app_detail_url = api_v2_url( "applications/{}/".format(client_id)) # Send request to this URL return {"app_list_url": '', "app_detail_url": app_detail_url}
def oauth_application_detail(auth, **kwargs): """Show detail for a single OAuth application""" # TODO: Remove dev_only restriction when APIv2 is released into production client_id = kwargs.get('client_id') # The client ID must be an active and existing record, and the logged-in user must have permission to view it. try: # record = ApiOAuth2Application.find_one(Q('client_id', 'eq', client_id)) except NoResultsFound: raise HTTPError(http.NOT_FOUND) if record.owner != auth.user: raise HTTPError(http.FORBIDDEN) if record.is_active is False: raise HTTPError(http.GONE) app_detail_url = api_v2_url("applications/{}/".format(client_id)) # Send request to this URL return {"app_list_url": '', "app_detail_url": app_detail_url}
def get_queryset(self): query = self.get_query_from_request() return ApiOAuth2Application.find(query)
def tearDown(self): super(TestApplicationDetail, self).tearDown() ApiOAuth2Application.remove() User.remove()
def create(self, validated_data): instance = ApiOAuth2Application(**validated_data) instance.save() return instance
def absolute_url(self, obj): obj = ApiOAuth2Application.find_one( Q('client_id', 'eq', obj['client_id'])) return obj.absolute_url
def tearDown(self): super(TestApplicationReset, self).tearDown() ApiOAuth2Application.remove() User.remove()
def absolute_url(self, obj): obj = ApiOAuth2Application.find_one(Q('client_id', 'eq', obj['client_id'])) return obj.absolute_url
def absolute_url(self, obj): obj = ApiOAuth2Application.find_one(Q("client_id", "eq", obj["client_id"])) return obj.absolute_url