Skip to content

Commit

Permalink
Removed owner from certificate API, disabled HTML Form
Browse files Browse the repository at this point in the history
  • Loading branch information
bjarnoldus committed Jan 6, 2022
1 parent 0e9365f commit 9e078e9
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion api/serializers.py
Expand Up @@ -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",
Expand Down
6 changes: 1 addition & 5 deletions api/views.py
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions bounca/settings.py
Expand Up @@ -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",
}

Expand Down
2 changes: 1 addition & 1 deletion bounca/urls.py
Expand Up @@ -14,7 +14,7 @@
path("auth/password-reset/confirm/<uidb64>/<token>", 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/<key>", TemplateView.as_view(), name="account_confirm_email"),
]

Expand Down
3 changes: 3 additions & 0 deletions 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
Expand Down

0 comments on commit 9e078e9

Please sign in to comment.