Skip to content

Commit

Permalink
API Key Creation & Management
Browse files Browse the repository at this point in the history
Added functionality for superusers and users to create and manage API keys, with Knox integration for secure key hashing.
  • Loading branch information
ygalnezri authored Jul 19, 2024
1 parent 26ffbcd commit 592b695
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Watcher/Watcher/accounts/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -304,4 +307,4 @@ def has_add_permission(self, request):
return False

admin.site.unregister(AuthToken)
admin.site.register(AuthToken, AuthTokenAdmin)
admin.site.register(AuthToken, AuthTokenAdmin)

0 comments on commit 592b695

Please sign in to comment.