Exemplo n.º 1
0
 class Meta:
     resource_name = 'staffing'
     queryset = Staffing.objects.all()
     authorization = DjangoAuthorization()
     authentication = MultiAuthentication(SessionAuthentication(), ApiKeyAuthentication())
     filtering = {'firestation': ALL}
     validation = FormValidation(form_class=StaffingForm)
     list_allowed_methods = ['get', 'post']
     detail_allowed_methods = ['get', 'put', 'delete']
     serializer = PrettyJSONSerializer()
     always_return_data = True
Exemplo n.º 2
0
 class Meta:
     queryset = Permission.objects.all()
     resource_name = 'permissions'
     authentication = SessionAuthentication()
     # Everyone can read the list of permissions
     authorization = DjangoAuthorization()
     always_return_data = True
     list_allowed_methods = ['get']
     detail_allowed_methods = ['get']
     max_limit = 0
     limit = 0
Exemplo n.º 3
0
    class BaseMeta:
        def __init__(self, *args, **kwargs):
            if not self.resource_name:
                self.resource_name = self.__class__.__name__.replace(
                    'Resource', '').lower()

        max_limit = 0
        authorization = DjangoAuthorization()
        authentication = MultiAuthentication(SessionAuthentication(),
                                             ApiKeyAuthentication())
        always_return_data = True
Exemplo n.º 4
0
 class Meta:
     resource_name = 'activity'
     collection = 'activity'
     datakey = 'courses'
     object_class = MongoObj
     authentication = DjangoAuthentication()
     authorization = DjangoAuthorization()
     allowed_methods = ['get', 'put']
     filtering = {
         "unit": ('exact'),
     }
Exemplo n.º 5
0
 class Meta(object):
     allowed_methods = ['get', 'put', 'post']
     always_return_data = True
     queryset = Version.objects.api()
     authentication = PostAuthentication()
     authorization = DjangoAuthorization()
     filtering = {
         "project": ALL_WITH_RELATIONS,
         "slug": ALL_WITH_RELATIONS,
         "active": ALL,
     }
 class Meta:
     queryset = User.objects.all()
     resource_name = 'pass'
     excludes = ['email', 'password', 'is_superuser']
     list_allowed_methods = []
     authorization = DjangoAuthorization()
     authentication = OAuth2ScopedAuthentication(
         #post=("read write",),
         #get=("read",),
         #put=("read", "write"),
     )
Exemplo n.º 7
0
 class Meta:
     resource_name = 'answer'
     collection = 'answers'
     datakey = 'questions'
     object_class = MongoObj
     authentication = DjangoAuthentication()
     authorization = DjangoAuthorization()
     allowed_methods = ['get', 'post', 'put']
     filtering = {
         "question": ('exact'),
     }
Exemplo n.º 8
0
 class Meta:
     queryset = Recommendation.objects.all()
     resource_name = 'recommendations'
     authorization = DjangoAuthorization()
     limit = 100
     always_return_data = False
     allowed_methods = ['get', 'post']
     filtering = {
         "recommendation_from": ("exact"),
         "recommendation_to": ("exact")
     }
Exemplo n.º 9
0
 class Meta(object):
     include_absolute_url = True
     allowed_methods = ['get', 'post', 'put']
     queryset = Project.objects.api()
     authentication = PostAuthentication()
     authorization = DjangoAuthorization()
     excludes = ['path', 'featured', 'programming_language']
     filtering = {
         'users': ALL_WITH_RELATIONS,
         'slug': ALL_WITH_RELATIONS,
     }
Exemplo n.º 10
0
 class Meta:
     queryset = ServerProfile.objects.all()
     resource_name = 'server_profile'
     authentication = AnonymousAuthentication()
     authorization = DjangoAuthorization()
     ordering = ['managed', 'default']
     list_allowed_methods = ['get']
     readonly = ['ui_name']
     filtering = {'name': ['exact'], 'managed': ['exact'],
                  'worker': ['exact'], 'default': ['exact'],
                  'user_selectable': ['exact']}
Exemplo n.º 11
0
 class Meta:
     queryset = PlaceKind.objects.all()
     default_format = "application/json"
     resource_name = 'placekind'
     authorization = DjangoAuthorization()
     limit = 0
     list_allowed_methods = ["get"]
     detail_allowed_methods = ["get"]
     excludes = [
         "summary", "biography", "honorific_prefix", "honorific_suffix"
     ]
Exemplo n.º 12
0
 class Meta:
     queryset = Suggestion.objects.all()
     resource_name = 'suggestions'
     fields = [
         'target_f',
         'translator_comment_f',
         'unit',
     ]
     list_allowed_methods = ['post']
     authorization = DjangoAuthorization()
     authentication = BasicAuthentication()
Exemplo n.º 13
0
 class Meta:
     allowed_methods = ['get', 'put', 'post', 'delete']
     queryset = FoiAttachment.objects.filter(
         belongs_to__request__visibility=2, approved=True)
     resource_name = 'attachment'
     authentication = AnonymousGetAuthentication()
     authorization = DjangoAuthorization()
     fields = [
         'id', 'belongs_to', 'name', 'filetype', 'approved', 'is_redacted',
         'size'
     ]
Exemplo n.º 14
0
 class Meta:
     resource_name = 'fire-departments'
     queryset = FireDepartment.objects.filter(archived=False)
     authorization = DjangoAuthorization()
     authentication = MultiAuthentication(SessionAuthentication(), ApiKeyAuthentication())
     cache = SimpleCache()
     list_allowed_methods = ['get']
     detail_allowed_methods = ['get']
     filtering = {'state': ALL, 'featured': ALL}
     serializer = PrettyJSONSerializer()
     limit = 120
Exemplo n.º 15
0
 class Meta:
     include_absolute_url = True
     allowed_methods = ['get', 'post', 'put']
     queryset = Project.objects.public()
     authentication = PostAuthentication()
     authorization = DjangoAuthorization()
     excludes = ['path', 'featured']
     filtering = {
         "users": ALL_WITH_RELATIONS,
         "slug": ALL_WITH_RELATIONS,
     }
Exemplo n.º 16
0
Arquivo: api.py Projeto: sevdog/rumal
 class Meta:
     queryset        = User.objects.all()
     resource_name   = 'user'
     authentication  = MultiAuthentication(SessionAuthentication(), ApiKeyAuthentication())
     authorization   = DjangoAuthorization()
     allowed_methods = ['get']
     fields          = ['id', 'username']
     ordering        = ['id', 'username']
     filtering = {
       'username': ALL,
     }
Exemplo n.º 17
0
 class Meta:
     queryset = PageFile.objects.all()
     resource_name = 'file'
     filtering = {
         'name': ALL,
         'slug': ALL,
     }
     ordering = ['name', 'slug']
     list_allowed_methods = ['get', 'post']
     authentication = ApiKeyWriteAuthentication()
     authorization = DjangoAuthorization()
Exemplo n.º 18
0
Arquivo: api.py Projeto: stef/nnmon
 class Meta:
     queryset = Violation.objects.all()
     list_allowed_methods = ['get', 'post']
     detail_allowed_methods = ['get', 'post', 'put', 'delete']
     resource_name = 'violations'
     authorization = DjangoAuthorization()
     filtering = {
         'country': ALL,
         'contract': ALL,
         'operator_ref': ALL_WITH_RELATIONS,
         'activationid': '',
     }
Exemplo n.º 19
0
 class Meta:
     queryset = FoiLaw.objects.all()
     resource_name = 'law'
     fields = [
         'id', 'name', 'slug', 'description', 'long_description', 'created',
         'updated', 'request_note', 'meta', 'combined', 'letter_start',
         'letter_end', 'jurisdiction', 'priority', 'url',
         'max_response_time', 'max_response_time_unit', 'refusal_reasons',
         'mediator'
     ]
     authentication = AnonymousGetAuthentication()
     authorization = DjangoAuthorization()
Exemplo n.º 20
0
 class Meta:
     queryset = Job.objects.all()
     resource_name = "job"
     authorization = DjangoAuthorization()
     authentication = AnonymousAuthentication()
     excludes = ["task_id", "locks_json", "wait_for_json"]
     ordering = ["created_at"]
     list_allowed_methods = ["get"]
     detail_allowed_methods = ["get", "put"]
     filtering = {"id": ["exact", "in"], "state": ["exact", "in"]}
     always_return_data = True
     validation = JobValidation()
Exemplo n.º 21
0
 class Meta:
     queryset = CorosyncConfiguration.objects.all()
     authorization = DjangoAuthorization()
     authentication = AnonymousAuthentication()
     resource_name = 'corosync_configuration'
     list_allowed_methods = ['get', 'put']
     detail_allowed_methods = ['get', 'put']
     filtering = {
         'host': ALL_WITH_RELATIONS,
         'id': ['exact'],
         'host__fqdn': ['exact', 'startswith']
     }
Exemplo n.º 22
0
 class Meta:
     # набор данных - все пользователи из БД
     queryset = Option.objects.all()
     # имя, которое нужно указывать в URL после /api/
     resource_name = 'option'
     # требуем прохождения авторизации
     authentication = BasicAuthentication()
     # права на добавление-обновление-удаление
     # выдаем на основании логина и пароля – только админам
     authorization = DjangoAuthorization()
     # стандартный класс для сохранения
     serializer = Serializer()
Exemplo n.º 23
0
 class Meta:
     queryset = LNetConfiguration.objects.all()
     authorization = DjangoAuthorization()
     authentication = AnonymousAuthentication()
     resource_name = "lnet_configuration"
     list_allowed_methods = ["get", "put"]
     detail_allowed_methods = ["get", "put"]
     filtering = {
         "host": ALL_WITH_RELATIONS,
         "id": ["exact"],
         "host__fqdn": ["exact", "startswith"]
     }
Exemplo n.º 24
0
    class Meta:
        queryset = Document.objects.all()
        resource_name = 'document'
        allowed_methods = ['get']
        authentication = KeyOnlyAuthentication()
        authorization = DjangoAuthorization()
        always_return_data = True
        detail_uri_name = 'id'

        filtering = {
            'name': ALL,
        }
Exemplo n.º 25
0
 class Meta:
     # набор данных - все загадки из БД
     queryset = Riddle.objects.all()
     # имя, которое нужно указывать в URL после /api/
     resource_name = 'riddle'
     # требуем указать логин и пароль в заголовках
     authentication = BasicAuthentication()
     # права на добавление-обновление-удаление
     # выдаем на основании логина и пароля - только админам
     authorization = DjangoAuthorization()
     # стандартный класс для сохранения
     serializer = Serializer()
Exemplo n.º 26
0
 class Meta:
     resource_name = 'comment'
     queryset = Comment.objects.all()
     list_allowed_methods = ['get', 'post']
     detail_allowed_methods = ['get', 'put', 'delete']
     ordering = ['-updated_at']
     filtering = {
         'event': ALL_WITH_RELATIONS,
     }
     always_return_data = True
     authentication = ApiKeyAuthentication()
     authorization = DjangoAuthorization()
Exemplo n.º 27
0
    class Meta:
        resource_name = 'ipscans'
        queryset = IPScan.objects.all()

        list_allowed_methods = ['get']
        detail_allowed_methods = ['get']
        include_resource_uri = True
        filtering = {'id': ALL, 'address': ALL, 'services': ALL, 'scan': ALL}

        authentication = DojoApiKeyAuthentication()
        authorization = DjangoAuthorization()
        serializer = Serializer(formats=['json'])
Exemplo n.º 28
0
    class Meta:
        list_allowed_methods = ['get', 'put']

        filtering = {
            'status': ALL_WITH_RELATIONS,
        }

        queryset = SystemResourceAlert.objects.all()
        resource_name = 'system_alert'
        authentication = MultiAuthentication(common_admin_authentication(),
                                             sys_admin_authentication())
        authorization = DjangoAuthorization()
Exemplo n.º 29
0
 class Meta:
     list_allowed_methods = ['get']
     queryset = SystemResourceAlertStatus.objects.all()
     filtering = {
         'status_id': (
             'exact',
             'startswith',
         )
     }
     resource_name = 'system_alert_status'
     authentication = MultiAuthentication(sys_admin_authentication())
     authorization = DjangoAuthorization()
Exemplo n.º 30
0
    class Meta:
        queryset = Nid.objects.select_related('network_interface', 'lnet_configuration').all()

        authorization = DjangoAuthorization()
        authentication = AnonymousAuthentication()
        validation = NidValidation()
        resource_name = 'nid'
        list_allowed_methods = ['get', 'post', 'delete']
        detail_allowed_methods = ['get', 'post', 'put', 'delete']
        filtering = {'network_interface': ALL_WITH_RELATIONS,
                     'lnet_configuration': ALL_WITH_RELATIONS,
                     'id': ['exact']}