Пример #1
0
 class Meta:
     object_class = Campaign
     allowed_methods = ('get', 'post', 'patch')
     resource_name = "campaigns"
     ordering = ("name", "aliases", "status", "actors", "backdoors",
                 "exploits", "indicators", "emails", "domains", "samples",
                 "events", "ips", "pcaps", "modified", "favorite", "id")
     authentication = MultiAuthentication(CRITsApiKeyAuthentication(),
                                          CRITsSessionAuthentication())
     authorization = authorization.Authorization()
     serializer = CRITsSerializer()
Пример #2
0
    class Meta:
        queryset= poll_models.Poll.objects.all()
        resource_name = 'poll_resource'
        authentication = authentication.Authentication()
        authorization = authorization.Authorization()
        # custom_meta_option = object() # add a custom meta option
        list_allowed_methods = ['get','post']
        detail_allowed_methods = ['put','get','delete']
        fields = ['question','pub_date']
#        filtering = {'pub_date':['exact']} # Filter entries
        limit = 20
Пример #3
0
	class Meta:
		queryset = Route.objects.all()
		resource_name = 'route'
		allowed_methods = ('get', 'post', 'put')
		authorization = authorization.Authorization()
		exclude = ['plan']

		filtering = {
			'markers': ALL,
			'lines': ALL,
		}
Пример #4
0
    class Meta:
        # Ordering by id so that pagination is predictable
        queryset = documents.Person.objects.all().order_by('id')
        allowed_methods = ('get', 'post', 'put', 'patch', 'delete')
        authorization = tastypie_authorization.Authorization()
        ordering = ('name', )
        paginator_class = paginator.Paginator

        polymorphic = {
            'person': 'self',
            'strangeperson': StrangePersonResource,
        }
Пример #5
0
 class Meta:
     resource_name = 'wifiledlamps'
     allowed_methods = ()
     authorization = authorization.Authorization()
     object_class = Wifiledlamps
     authentication = MultiAuthentication(CustomApiKeyAuthentication())
     extra_actions = [{
         'name': 'switch',
         'http_method': 'POST',
         'resource_type': 'list',
         'fields': {
             'on_off': {
                 'type': 'string',
                 'required': True,
                 'description': 'on or off',
                 'paramType': 'body'
             },
             'rooms': {
                 'type': 'list',
                 'required': True,
                 'description':
                 "Provide a list of rooms : ['all','bedroom','kitchen'] ...",
                 'paramType': 'body'
             },
             'color': {
                 'type': 'string',
                 'required': False,
                 'description': "Color to use",
                 'paramType': 'body'
             },
             'intensity': {
                 'type': 'string',
                 'required': False,
                 'description': 'Intensity to use',
                 'paramType': 'body'
             },
             'groups': {
                 'type': 'list',
                 'required': False,
                 'description':
                 "Which groups to use (1,2,3,4). By default, will use all.",
                 'paramType': 'body'
             },
             'lamptype': {
                 'type': 'string',
                 'required': False,
                 'description':
                 "rgb, white or rgbw. By default, will use rgbw.",
                 'paramType': 'body'
             },
         }
     }]
Пример #6
0
 class Meta:
     queryset = documents.Comment.objects.all()
     allowed_methods = ('get', 'post', 'put', 'patch', 'delete')
     authorization = authorization.Authorization(
     )  #TODO: own-submission authorization, allow admin to put/patch
     exclude = ['topic']
     filtering = {
         "topic": [
             "exact",
         ],
         "author": [
             "exact",
         ],
     }
Пример #7
0
 class Meta:
     queryset = Plugin.objects.all()
     allowed_methods = ('get', 'post', 'put', 'delete')
     authorization = authorization.Authorization()
     authentication = MultiAuthentication(CustomApiKeyAuthentication())
     extra_actions = [
         {
             'name':
             'install',
             'summary':
             'Install a plugin',
             'http_method':
             'POST',
             "errorResponses": [{
                 "reason": "Plugin was installed correctly.",
                 "code": 201
             }, {
                 'reason': "There was a problem during the install.",
                 'code': 304
             }],
             'fields': {}
         },
         {
             'name': 'uninstall',
             'summary': 'Uninstall a plugin',
             'http_method': 'GET',
             'fields': {}
         },
         {
             'name': 'enable',
             'summary': 'Enable a plugin',
             'http_method': 'GET',
             'fields': {}
         },
         {
             'name': 'disable',
             'summary': 'Disable a plugin',
             'http_method': 'GET',
             'fields': {}
         },
         {
             'name': 'methodslist',
             'summary':
             'List the method of all (or the plugin name in parameter) plugins installed',
             'http_method': 'GET',
             'fields': {}
         },
     ]
Пример #8
0
    class Meta:
        queryset = LisaUser.objects.all()
        authentication = MultiAuthentication(CustomApiKeyAuthentication())
        authorization = authorization.Authorization()
        """fields = ['username', 'first_name', 'last_name', 'apikey',
                  'api_key_created', 'email', 'date_joined',
                  'is_active', 'is_superuser', 'is_staff', 'id',
                  'features', 'user_permissions'
        ]"""

        # FIXME :Problem with the put : why I receive an _id field on mongodb save with user and not plugin ?
        allowed_methods = ['get', 'post', 'put', 'delete', 'patch']
        login_allowed_methods = [
            'post',
        ]
        extra_actions = [{
            'name': 'login',
            'http_method': 'POST',
            'resource_type': 'list',
            'fields': {
                'username': {
                    'type': 'string',
                    'required': True,
                    'description': 'Unique username required.',
                    'paramType': 'body'
                },
                'password': {
                    'type': 'string',
                    'required': True,
                    'description': 'password required',
                    'paramType': 'body'
                }
            }
        }, {
            'name': 'logout',
            'http_method': 'POST',
            'resource_type': 'list',
            'fields': {}
        }, {
            'name': 'regenerateapikey',
            'summary': 'Regenerate the API Key for a user',
            'http_method': 'GET',
            'fields': {}
        }]
 class Meta(object):
     queryset = documents.UnregisteredCompany.objects.all()
     allowed_methods = ('get', 'post', 'put', 'patch', 'delete')
     authorization = tastypie_authorization.Authorization()
     paginator_class = paginator.Paginator
 class Meta(object):
     queryset = documents.ReadonlyParent.objects.all()
     allowed_methods = ('get', 'post', 'put', 'patch', 'delete')
     authorization = tastypie_authorization.Authorization()
 class Meta(object):
     queryset = documents.Pipe.objects.all()
     resource_name = 'pipes'
     allowed_methods = ('get', 'post', 'put', 'delete')
     authorization = tastypie_authorization.Authorization()
 class Meta(object):
     object_class = documents.EmbeddedCommentWithID
     allowed_methods = ('get', 'post', 'put', 'patch', 'delete')
     authorization = tastypie_authorization.Authorization()
     paginator_class = paginator.Paginator
Пример #13
0
 class Meta:
     resource_name = 'programmetv'
     allowed_methods = ()
     authorization = authorization.Authorization()
     object_class = ProgrammeTV
Пример #14
0
 class Meta:
     object_class = Intent
     authorization = authorization.Authorization()
Пример #15
0
 class Meta:
     queryset = Conversation.objects.all()
     resource_name = 'conversations'
     allowed_methods = ('get', 'post', 'put', 'delete')
     authorization = authorization.Authorization()
Пример #16
0
 class Meta:
     queryset = documents.EmbeddedListInEmbeddedDocTest.objects.all()
     allowed_methods = ('get', 'post', 'put', 'patch', 'delete')
     authorization = tastypie_authorization.Authorization()
Пример #17
0
 class Meta:
     queryset = documents.EmbeddedListFieldTest.objects.all()
     allowed_methods = ('get', 'post', 'put', 'patch', 'delete')
     authorization = tastypie_authorization.Authorization()
     ordering = ('id', 'embeddedlist')
Пример #18
0
Файл: api.py Проект: gdumee/LISA
 class Meta:
     resource_name = 'user'
     allowed_methods = ('get', 'post')
     authorization = authorization.Authorization()
     object_class = User
Пример #19
0
 class Meta:
     queryset = documents.Board.objects.all()
     allowed_methods = ('get', 'post', 'put', 'patch', 'delete')
     authorization = tastypie_authorization.Authorization()
Пример #20
0
Файл: api.py Проект: gdumee/LISA
 class Meta:
     resource_name = 'lisa'
     allowed_methods = ()
     authorization = authorization.Authorization()
     object_class = Lisa
     extra_actions = [{
         'name': 'engine/reload',
         'http_method': 'GET',
         'fields': {}
     }, {
         'name': 'scheduler/reload',
         'http_method': 'GET',
         'fields': {}
     }, {
         'name': 'intents',
         'http_method': 'GET',
         'fields': {}
     }, {
         'name': 'speak',
         'http_method': 'POST',
         'fields': {
             'message': {
                 'type': 'string',
                 'required': True,
                 'description': 'The message to transmit to client(s)'
             },
             'clients_zone': {
                 'type':
                 'list',
                 'required':
                 True,
                 'description':
                 "Provide a list of zones : ['all','WebSocket','Bedroom'] ..."
             }
         }
     }, {
         'name': 'tts/google',
         'http_method': 'POST',
         'fields': {
             'message': {
                 'type': 'string',
                 'required': True,
                 'description': 'The message to vocalize'
             },
             'lang': {
                 'type': 'string',
                 'required': True,
                 'description': "Lang of the message"
             }
         }
     }, {
         'name': 'tts/pico',
         'http_method': 'POST',
         'fields': {
             'message': {
                 'type': 'string',
                 'required': True,
                 'description': 'The message to vocalize'
             },
             'lang': {
                 'type': 'string',
                 'required': True,
                 'description': "Lang of the message"
             }
         }
     }]
Пример #21
0
 class Meta:
     resource_name = 'sncf'
     allowed_methods = ()
     authorization = authorization.Authorization()
     object_class = SNCF
Пример #22
0
 class Meta:
     queryset = models.Project.objects.all()
     resource_name = 'projects'
     authorization = authorization.Authorization()
     always_return_data = True
     limit = 100
 class Meta(object):
     queryset = documents.EmbeddedListWithFlagFieldTest.objects.all()
     allowed_methods = ('get', 'post', 'put', 'patch', 'delete')
     authorization = tastypie_authorization.Authorization()
Пример #24
0
 class Meta:
     queryset = documents.ReferencedListFieldTest.objects.all()
     allowed_methods = ('get', 'post', 'put', 'patch', 'delete')
     authorization = tastypie_authorization.Authorization()
 class Meta(object):
     object_class = documents.Person
     allowed_methods = ('get', 'post')
     authorization = tastypie_authorization.Authorization()
     resource_name = 'personobjectclass'
Пример #26
0
 class Meta:
     queryset = documents.Exporter.objects.all()
     resource_name = 'exporters'
     allowed_methods = ('get', 'post', 'put', 'delete')
     authorization = tastypie_authorization.Authorization()
 class Meta(object):
     queryset = documents.DatetimeFieldTest.objects.all()
     allowed_methods = ('get', 'post', 'put', 'patch', 'delete')
     authorization = tastypie_authorization.Authorization()
Пример #28
0
 class Meta:
     queryset = documents.Individual.objects.all()
     allowed_methods = ('get', 'post', 'put', 'patch', 'delete')
     authorization = tastypie_authorization.Authorization()
     paginator_class = paginator.Paginator
Пример #29
0
 class Meta:
     resource_name = 'meteo'
     allowed_methods = ()
     authorization = authorization.Authorization()
     object_class = Meteo
Пример #30
0
 class Meta:
     resource_name = 'wifiledlamps'
     allowed_methods = ()
     authorization = authorization.Authorization()
     object_class = Wifiledlamps