Exemple #1
0
 class Meta(AppResource.Meta):
     resource_name = 'search'
     allowed_methods = []
     detail_allowed_methods = []
     list_allowed_methods = ['get']
     authorization = ReadOnlyAuthorization()
     authentication = OptionalOAuthAuthentication()
     slug_lookup = None
Exemple #2
0
 class Meta(MarketplaceResource.Meta):
     resource_name = 'global'
     authentication = OptionalOAuthAuthentication()
     authorization = Authorization()
     detail_allowed_methods = ['get']
     list_allowed_methods = []
     object_class = GenericObject
     validation = CleanedDataFormValidation(form_class=GlobalStatsForm)
Exemple #3
0
 class Meta(SearchResource.Meta):
     authorization = ReadOnlyAuthorization()
     authentication = OptionalOAuthAuthentication()
     detail_allowed_methods = []
     fields = SearchResource.Meta.fields + ['id', 'cat']
     list_allowed_methods = ['get']
     resource_name = 'search/featured'
     slug_lookup = None
Exemple #4
0
 class Meta(MarketplaceResource.Meta):
     always_return_data = True
     authentication = OptionalOAuthAuthentication()
     authorization = Authorization()
     detail_allowed_methods = []
     list_allowed_methods = ['post']
     object_class = dict
     resource_name = 'test'
     validation = CleanedDataFormValidation(form_class=TestInstall)
Exemple #5
0
 class Meta(MarketplaceResource.Meta):
     always_return_data = True
     authentication = (SharedSecretAuthentication(),
                       OptionalOAuthAuthentication())
     authorization = Authorization()
     detail_allowed_methods = []
     list_allowed_methods = ['post']
     object_class = dict
     resource_name = 'install'
Exemple #6
0
 class Meta(MarketplaceModelResource.Meta):
     queryset = ReviewFlag.objects.all()
     resource_name = 'rating_flag'
     list_allowed_methods = ['post']
     detail_allowed_methods = []
     authentication = (SharedSecretAuthentication(),
                       OptionalOAuthAuthentication())
     authorization = Authorization()
     fields = ['review', 'flag', 'note', 'user']
Exemple #7
0
 class Meta(MarketplaceResource.Meta):
     resource_name = 'feedback'
     always_return_data = True
     list_allowed_methods = ['post']
     detail_allowed_methods = []
     authentication = OptionalOAuthAuthentication()
     authorization = Authorization()
     object_class = GenericObject
     include_resource_uri = False
     throttle = CacheThrottle(throttle_at=30)
Exemple #8
0
 class Meta(AppResource.Meta):
     resource_name = 'search'
     allowed_methods = []
     detail_allowed_methods = []
     list_allowed_methods = ['get']
     authorization = ReadOnlyAuthorization()
     authentication = OptionalOAuthAuthentication()
     slug_lookup = None
     # Override CacheThrottle with a no-op.
     throttle = BaseThrottle()
Exemple #9
0
 class Meta(MarketplaceModelResource.Meta):
     queryset = FileUpload.objects.all()
     fields = ['valid', 'validation']
     list_allowed_methods = ['post']
     detail_allowed_methods = ['get']
     always_return_data = True
     authentication = OptionalOAuthAuthentication()
     authorization = Authorization()
     resource_name = 'validation'
     serializer = Serializer(formats=['json'])
Exemple #10
0
 class Meta(MarketplaceResource.Meta):
     api_name = 'apps'
     queryset = Webapp.objects.all()  # Gets overriden in dispatch.
     fields = ['privacy_policy']
     detail_allowed_methods = ['get', 'put']
     always_return_data = True
     authentication = OptionalOAuthAuthentication()
     authorization = AppOwnerAuthorization()
     resource_name = 'privacy'
     serializer = Serializer(formats=['json'])
     slug_lookup = 'app_slug'
     # Throttle users without Apps:APIUnthrottled at 10 POST requests/day.
     throttle = CacheThrottle(throttle_at=10, timeframe=60 * 60 * 24)
Exemple #11
0
 class Meta(MarketplaceResource.Meta):
     always_return_data = True
     list_allowed_methods = ['post']
     detail_allowed_methods = []
     authentication = OptionalOAuthAuthentication()
     authorization = Authorization()
     object_class = GenericObject
     include_resource_uri = False
     validation_form = None
     rename_field_map = [
         ('text', 'message'),
     ]
     throttle = CacheThrottle(throttle_at=30)
Exemple #12
0
 class Meta(MarketplaceResource.Meta):
     authentication = OptionalOAuthAuthentication()
     authorization = AnonymousReadOnlyAuthorization(
         authorizer=PermissionAuthorization('ProductIcon', 'Create'))
     detail_allowed_methods = ['get']
     fields = ['ext_url', 'ext_size', 'size']
     filtering = {
         'ext_url': 'exact',
         'ext_size': 'exact',
         'size': 'exact',
     }
     list_allowed_methods = ['get', 'post']
     queryset = ProductIcon.objects.filter()
     resource_name = 'product/icon'
     validation = CleanedDataFormValidation(form_class=ProductIconForm)
Exemple #13
0
 class Meta:
     resource_name = 'search'
     allowed_methods = []
     detail_allowed_methods = []
     list_allowed_methods = ['get']
     authorization = ReadOnlyAuthorization()
     authentication = (SharedSecretAuthentication(),
                       OptionalOAuthAuthentication())
     slug_lookup = None
     queryset = Webapp.objects.all()  # Gets overriden in dispatch.
     fields = ['categories', 'description', 'device_types', 'homepage',
               'id', 'name', 'payment_account', 'premium_type',
               'status', 'support_email', 'support_url']
     always_return_data = True
     serializer = Serializer(formats=['json'])
Exemple #14
0
 class Meta(MarketplaceModelResource.Meta):
     queryset = Webapp.objects.all()  # Gets overriden in dispatch.
     fields = ['categories', 'description', 'device_types', 'homepage',
               'id', 'name', 'payment_account', 'premium_type',
               'status', 'support_email', 'support_url']
     list_allowed_methods = ['get', 'post']
     detail_allowed_methods = ['get', 'put', 'delete']
     always_return_data = True
     authentication = (SharedSecretAuthentication(),
                       OptionalOAuthAuthentication())
     authorization = AppOwnerAuthorization()
     resource_name = 'app'
     serializer = Serializer(formats=['json'])
     slug_lookup = 'app_slug'
     # Throttle users without Apps:APIUnthrottled at 10 POST requests/day.
     throttle = CacheThrottle(throttle_at=10, timeframe=60 * 60 * 24)
Exemple #15
0
 class Meta(MarketplaceModelResource.Meta):
     queryset = Addon.objects.filter(type=amo.ADDON_WEBAPP)
     fields = [
         'categories', 'description', 'device_types', 'homepage', 'id',
         'name', 'privacy_policy', 'status', 'summary', 'support_email',
         'support_url'
     ]
     list_allowed_methods = ['get', 'post']
     allowed_methods = ['get', 'put']
     always_return_data = True
     authentication = OptionalOAuthAuthentication()
     authorization = AppOwnerAuthorization()
     resource_name = 'app'
     serializer = Serializer(formats=['json'])
     slug_lookup = 'app_slug'
     # Throttle users without Apps:APIUnthrottled at 10 POST requests/day.
     throttle = CacheThrottle(throttle_at=10, timeframe=60 * 60 * 24)
Exemple #16
0
    class Meta:
        # Unfortunately, the model class name for ratings is "Review".
        queryset = Review.objects.valid()
        resource_name = 'rating'
        list_allowed_methods = ['get', 'post']
        detail_allowed_methods = ['get', 'put', 'delete']
        always_return_data = True
        authentication = (SharedSecretAuthentication(),
                          OptionalOAuthAuthentication())
        authorization = AnonymousReadOnlyAuthorization()
        fields = ['rating', 'body']

        filtering = {
            'app': ('exact', ),
            'user': ('exact', ),
            'pk': ('exact', ),
        }

        ordering = ['created']