Пример #1
0
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}
Пример #2
0
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}
Пример #3
0
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}
Пример #4
0
 def get_queryset(self):
     query = self.get_query_from_request()
     return ApiOAuth2Application.find(query)
Пример #5
0
 def tearDown(self):
     super(TestApplicationDetail, self).tearDown()
     ApiOAuth2Application.remove()
     User.remove()
Пример #6
0
 def get_queryset(self):
     query = self.get_query_from_request()
     return ApiOAuth2Application.find(query)
Пример #7
0
 def create(self, validated_data):
     instance = ApiOAuth2Application(**validated_data)
     instance.save()
     return instance
Пример #8
0
 def absolute_url(self, obj):
     obj = ApiOAuth2Application.find_one(
         Q('client_id', 'eq', obj['client_id']))
     return obj.absolute_url
Пример #9
0
 def tearDown(self):
     super(TestApplicationReset, self).tearDown()
     ApiOAuth2Application.remove()
     User.remove()
Пример #10
0
 def absolute_url(self, obj):
     obj = ApiOAuth2Application.find_one(Q('client_id', 'eq', obj['client_id']))
     return obj.absolute_url
Пример #11
0
 def absolute_url(self, obj):
     obj = ApiOAuth2Application.find_one(Q("client_id", "eq", obj["client_id"]))
     return obj.absolute_url