Refactor the REST API app

Remove the APIRoot view.

Remove the Endpoint class.

Remove the EndpointSerializer.

Move API documentation generation from the root urls module
to the app's urls module.

Update the app API URL generation to be based on viewsets
instead of an custom api_urls list.

Remove MayanObjectPermissionsFilter and replace it with
MayanViewSetObjectPermissionsFilter which allows mapping
a required permission to a specific viewset action.

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2019-02-06 05:19:07 -04:00
parent 7ba47d5c5f
commit 627056f1ae
13 changed files with 228 additions and 128 deletions
+11
View File
@@ -0,0 +1,11 @@
from __future__ import absolute_import, unicode_literals
from rest_framework import viewsets
from .filters import MayanViewSetObjectPermissionsFilter
from .permissions import MayanViewSetPermission
class MayanAPIModelViewSet(viewsets.ModelViewSet):
filter_backends = (MayanViewSetObjectPermissionsFilter,)
permission_classes = (MayanViewSetPermission,)