Пример #1
0
 class Meta(object):
     resource_name = 'user_domains'
     authentication = ApiKeyAuthentication()
     object_class = UserDomain
     include_resource_uri = False
Пример #2
0
 class Meta(object):
     resource_name = 'domain_usernames'
     authentication = ApiKeyAuthentication()
     object_class = User
     include_resource_uri = False
     allowed_methods = ['get']
Пример #3
0
 class Meta:
     queryset = Category.objects.all()
     resource_name = 'category'
     authentication = ApiKeyAuthentication()
Пример #4
0
 class Meta:
     queryset = Candidate.objects.all()
     resource_name = 'candidate'
     authentication = ApiKeyAuthentication()
Пример #5
0
            'sex': ALL,
            'age': ALL,
            'remarks': ALL,
            'date_entered': ALL,
            'signed': ALL,
            'storage_location': ALL,
            'body_size': ALL,
        }
        max_limit = 0
        authentication = Authentication(
        )  #this means no authentication, which is OK in this case, because only allowed method is GET


#####DRP API resources
#####common settings to be used for all DRP API resources
drp_authentication = ApiKeyAuthentication(
)  #will require a username and api_key as url parameters, otherwise return 401 unauthorized
drp_authorization = CustomDjangoAuthorization(
    appname="drp", modelname="drp_occurrence"
)  #look to custom Django Authorization class to determine permissions
drp_allowed_methods = ['get', 'post']

# class drp_taxonomyResource(ModelResource):
#     class Meta:
#         max_limit=0
#         queryset = drp_taxonomy.objects.all()
#         allowed_methods= drp_allowed_methods
#         resource_name = 'drp_taxonomy'
#         authorization = drp_authorization
#         authentication = drp_authentication

Пример #6
0
 class Meta:
     queryset = Question.objects.all()
     resource_name = 'question'
     authentication = ApiKeyAuthentication()
Пример #7
0
 def get(self, request):
     authentication = ApiKeyAuthentication()
     if authentication.is_authenticated(request) is not True:
         return Response(Respostas.NAO_AUTORIZADO.value)
Пример #8
0
    def test_multiauth_apikey_and_basic_auth__no_details_fails(self):
        auth = MultiAuthentication(BasicAuthentication(), ApiKeyAuthentication())
        request = HttpRequest()

        self.assertEqual(isinstance(auth.is_authenticated(request), HttpUnauthorized), True)
Пример #9
0
 class Meta:
     queryset = Bulletin.objects.all()
     resource_name = 'bulletin'
     authorization = Authorization()
     authentication = ApiKeyAuthentication()
     always_return_data = True
Пример #10
0
 class Meta(DeviceResource.Meta):
     authentication = ApiKeyAuthentication()
Пример #11
0
 class Meta:
     resource_name = 'customcareer'
     queryset = CustomCareer.objects.all()
     authentication = ApiKeyAuthentication()
     authorization = DjangoAuthorization()