mirror of
https://github.com/jumpserver/jumpserver.git
synced 2026-08-08 23:35:34 +00:00
perf: Support batch import of leak passwords
This commit is contained in:
@@ -1627,5 +1627,6 @@
|
||||
"removeWarningMsg": "Are you sure you want to remove",
|
||||
"setVariable": "Set variable",
|
||||
"userId": "User ID",
|
||||
"userName": "User name"
|
||||
"userName": "User name",
|
||||
"LeakPasswordList": "Leaked password list"
|
||||
}
|
||||
@@ -6,6 +6,7 @@ from rest_framework.generics import ListAPIView, CreateAPIView
|
||||
from rest_framework.views import Response
|
||||
from rest_framework_bulk.generics import BulkModelViewSet
|
||||
|
||||
from common.api.action import RenderToJsonMixin
|
||||
from common.drf.filters import IDSpmFilterBackend
|
||||
from users.utils import LoginIpBlockUtil
|
||||
from ..models import LeakPasswords
|
||||
@@ -61,7 +62,7 @@ class UnlockIPSecurityAPI(CreateAPIView):
|
||||
return Response(status=200)
|
||||
|
||||
|
||||
class LeakPasswordViewSet(BulkModelViewSet):
|
||||
class LeakPasswordViewSet(BulkModelViewSet, RenderToJsonMixin):
|
||||
serializer_class = LeakPasswordPSerializer
|
||||
model = LeakPasswords
|
||||
rbac_perms = {
|
||||
@@ -70,6 +71,12 @@ class LeakPasswordViewSet(BulkModelViewSet):
|
||||
queryset = LeakPasswords.objects.none()
|
||||
search_fields = ['password']
|
||||
|
||||
def get_object(self):
|
||||
pk = self.kwargs.get('pk')
|
||||
if pk:
|
||||
return self.get_queryset().get(id=pk)
|
||||
return super().get_object()
|
||||
|
||||
def get_queryset(self):
|
||||
return LeakPasswords.objects.using('sqlite').all()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user