API updates
- Move all generic API classes definitions to the rest_api.generics module. - Update API status code on insufficient access for the apps: indexes, parsing, documents, metadata, ocr, permission, user management. - Update API tests. Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from rest_framework import generics
|
||||
|
||||
from mayan.apps.rest_api.filters import MayanObjectPermissionsFilter
|
||||
from mayan.apps.rest_api.permissions import MayanPermission
|
||||
from mayan.apps.rest_api import generics
|
||||
|
||||
from .models import Key
|
||||
from .permissions import (
|
||||
@@ -17,10 +14,8 @@ class APIKeyListView(generics.ListCreateAPIView):
|
||||
get: Returns a list of all the keys.
|
||||
post: Upload a new key.
|
||||
"""
|
||||
filter_backends = (MayanObjectPermissionsFilter,)
|
||||
mayan_object_permissions = {'GET': (permission_key_view,)}
|
||||
mayan_view_permissions = {'POST': (permission_key_upload,)}
|
||||
permission_classes = (MayanPermission,)
|
||||
queryset = Key.objects.all()
|
||||
serializer_class = KeySerializer
|
||||
|
||||
@@ -30,7 +25,6 @@ class APIKeyView(generics.RetrieveDestroyAPIView):
|
||||
delete: Delete the selected key.
|
||||
get: Return the details of the selected key.
|
||||
"""
|
||||
filter_backends = (MayanObjectPermissionsFilter,)
|
||||
mayan_object_permissions = {
|
||||
'DELETE': (permission_key_delete,),
|
||||
'GET': (permission_key_view,),
|
||||
|
||||
Reference in New Issue
Block a user