From 592b695b8c76f7df7d2bdad6a69171edc65eb27a Mon Sep 17 00:00:00 2001 From: Ygal Nezri <155719988+ygalnezri@users.noreply.github.com> Date: Fri, 19 Jul 2024 11:14:40 +0200 Subject: [PATCH] API Key Creation & Management Added functionality for superusers and users to create and manage API keys, with Knox integration for secure key hashing. --- Watcher/Watcher/accounts/admin.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Watcher/Watcher/accounts/admin.py b/Watcher/Watcher/accounts/admin.py index 962191a..49a8dbb 100644 --- a/Watcher/Watcher/accounts/admin.py +++ b/Watcher/Watcher/accounts/admin.py @@ -194,6 +194,9 @@ def get_expiry(self, obj): get_created.short_description = 'Created' get_expiry.short_description = 'Expiry' + def has_add_permission(self, request): + return True + def get_queryset(self, request): qs = super().get_queryset(request) if not request.user.is_superuser: @@ -304,4 +307,4 @@ def has_add_permission(self, request): return False admin.site.unregister(AuthToken) -admin.site.register(AuthToken, AuthTokenAdmin) \ No newline at end of file +admin.site.register(AuthToken, AuthTokenAdmin)