diff --git a/opentech/apply/funds/api_views.py b/opentech/apply/funds/api_views.py index bb09838102064ee24e79d8147cc0f5226c147728..75d31ef1c336ecf530bb79fc760384b152b22ec1 100644 --- a/opentech/apply/funds/api_views.py +++ b/opentech/apply/funds/api_views.py @@ -9,6 +9,7 @@ from rest_framework import generics, mixins, permissions from rest_framework.response import Response from rest_framework.exceptions import (NotFound, PermissionDenied, ValidationError) +from rest_framework_api_key.permissions import HasAPIKey from django_filters import rest_framework as filters from opentech.api.pagination import StandardResultsSetPagination @@ -69,7 +70,7 @@ class SubmissionList(generics.ListAPIView): queryset = ApplicationSubmission.objects.current().with_latest_update() serializer_class = SubmissionListSerializer permission_classes = ( - permissions.IsAuthenticated, IsApplyStaffUser, + HasAPIKey | permissions.IsAuthenticated, HasAPIKey | IsApplyStaffUser, ) filter_backends = (filters.DjangoFilterBackend,) filter_class = SubmissionsFilter diff --git a/opentech/settings/base.py b/opentech/settings/base.py index 95637252a885211a5508b7b8832bb20762c5af1c..33775faf119b12b8a78aec6b747443c12863db48 100644 --- a/opentech/settings/base.py +++ b/opentech/settings/base.py @@ -126,6 +126,7 @@ INSTALLED_APPS = [ 'django_otp.plugins.otp_static', 'two_factor', 'rest_framework', + 'rest_framework_api_key', 'wagtailcache', 'hijack', diff --git a/requirements.txt b/requirements.txt index 5926b69480b97461753408a208bf43a746d30a51..d210db3f82e91cb9114d4ebb96e8675d9c07db93 100644 --- a/requirements.txt +++ b/requirements.txt @@ -36,6 +36,7 @@ django-two-factor-auth==1.9.1 django-webpack-loader==0.6.0 django_select2==7.1.0 djangorestframework==3.9.2 +djangorestframework-api-key==1.3.0 django==2.1.11 gunicorn==19.9.0 mailchimp3==3.0.7