mirror of https://github.com/jumpserver/jumpserver
fix(command): 修复命令导出选中项会导出全部的问题
parent
9f6540afe3
commit
95aa9781c3
|
@ -98,7 +98,11 @@ class IDSpmFilter(filters.BaseFilterBackend):
|
|||
resources_id = cache.get(cache_key)
|
||||
if resources_id is None or not isinstance(resources_id, list):
|
||||
return queryset
|
||||
queryset = queryset.filter(id__in=resources_id)
|
||||
if isinstance(queryset, list):
|
||||
# CommandViewSet
|
||||
queryset = [q for q in queryset if q['id'] in resources_id]
|
||||
else:
|
||||
queryset = queryset.filter(id__in=resources_id)
|
||||
return queryset
|
||||
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ from django.template import loader
|
|||
from orgs.utils import current_org
|
||||
from common.permissions import IsOrgAdminOrAppUser, IsOrgAuditor
|
||||
from common.utils import get_logger
|
||||
from common.mixins import ExtraFilterFieldsMixin
|
||||
from ..backends import (
|
||||
get_command_storage, get_multi_command_storage,
|
||||
SessionCommandSerializer,
|
||||
|
@ -86,7 +87,7 @@ class CommandQueryMixin:
|
|||
return date_from_st, date_to_st
|
||||
|
||||
|
||||
class CommandViewSet(CommandQueryMixin, viewsets.ModelViewSet):
|
||||
class CommandViewSet(ExtraFilterFieldsMixin, CommandQueryMixin, viewsets.ModelViewSet):
|
||||
"""接受app发送来的command log, 格式如下
|
||||
{
|
||||
"user": "admin",
|
||||
|
|
Loading…
Reference in New Issue