diff --git a/api/serializers.py b/api/serializers.py index 84b8d9a..96cbc92 100644 --- a/api/serializers.py +++ b/api/serializers.py @@ -35,11 +35,13 @@ class CertificateSerializer(serializers.ModelSerializer): max_length=200, required=False, allow_null=True, allow_blank=True ) + owner = serializers.HiddenField(default=serializers.CurrentUserDefault()) + class Meta: fields = ( "id", - "owner", "name", + "owner", "parent", "type", "dn", diff --git a/api/views.py b/api/views.py index a2a8c53..94e2a9f 100644 --- a/api/views.py +++ b/api/views.py @@ -55,16 +55,12 @@ class CertificateListView(TrapDjangoValidationErrorCreateMixin, ListCreateAPIVie def get_queryset(self): """ - This view should return a list of all the purchases + This view should return a list of all the certificates for the currently authenticated user. """ user = self.request.user return Certificate.objects.filter(owner=user) - def create(self, request, *args, **kwargs): - request.data["owner"] = request.user.id - return super().create(request, *args, **kwargs) - class CertificateInstanceView(RetrieveDestroyAPIView): model = Certificate diff --git a/bounca/settings.py b/bounca/settings.py index 5693097..c26391b 100644 --- a/bounca/settings.py +++ b/bounca/settings.py @@ -141,6 +141,7 @@ def get_services_config(path, filename="services.yaml"): "rest_framework.authentication.TokenAuthentication", "rest_framework.authentication.SessionAuthentication", ), + "DEFAULT_PARSER_CLASSES": ["rest_framework.parsers.JSONParser"], "EXCEPTION_HANDLER": "vuetifyforms.views.vue_exception_handler", } diff --git a/bounca/urls.py b/bounca/urls.py index ff9c60f..31556ee 100644 --- a/bounca/urls.py +++ b/bounca/urls.py @@ -14,7 +14,7 @@ path("auth/password-reset/confirm//", TemplateView.as_view(), name="password_reset_confirm"), path("auth/login/", VerifyEmailView.as_view(), name="account_email_verification_sent"), path("api/", include(urlpatterns_api)), - path("auth/", include("rest_framework.urls")), + path("auth-api/", include("rest_framework.urls")), path("auth/account-confirm-email/", TemplateView.as_view(), name="account_confirm_email"), ] diff --git a/changelog.md b/changelog.md index 79ccb65..8ac70c5 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,9 @@ # Change Log The BounCA change history +## [0.2.1] - Release 2022-01-06 +* Removed owner from certificate API, disabled HTML Form + ## [0.2.0] - Release 2021-12-29 * Rebuild of BounCA, old db not compatible * Python based certificate factory