mirror of https://github.com/jumpserver/jumpserver
[Update] 修改command搜索
parent
858c7df86b
commit
5b1ee67820
|
@ -26,14 +26,22 @@ class CommandQueryMixin:
|
||||||
pagination_class = LimitOffsetPagination
|
pagination_class = LimitOffsetPagination
|
||||||
permission_classes = [IsOrgAdminOrAppUser | IsAuditor]
|
permission_classes = [IsOrgAdminOrAppUser | IsAuditor]
|
||||||
filter_fields = [
|
filter_fields = [
|
||||||
"asset", "system_user", "user", "input", "session",
|
"asset", "system_user", "user", "session",
|
||||||
]
|
]
|
||||||
default_days_ago = 5
|
default_days_ago = 5
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
date_from, date_to = self.get_date_range()
|
date_from, date_to = self.get_date_range()
|
||||||
|
q = self.request.query_params
|
||||||
multi_command_storage = get_multi_command_storage()
|
multi_command_storage = get_multi_command_storage()
|
||||||
queryset = multi_command_storage.filter(date_from=date_from, date_to=date_to)
|
queryset = multi_command_storage.filter(
|
||||||
|
date_from=date_from, date_to=date_to, input=q.get("input"),
|
||||||
|
user=q.get("user"), asset=q.get("asset"),
|
||||||
|
system_user=q.get("system_user")
|
||||||
|
)
|
||||||
|
return queryset
|
||||||
|
|
||||||
|
def filter_queryset(self, queryset):
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
def get_filter_fields(self):
|
def get_filter_fields(self):
|
||||||
|
|
|
@ -80,7 +80,7 @@ class CommandStore(CommandBase):
|
||||||
filter_kwargs['timestamp__lte'] = int(date_to)
|
filter_kwargs['timestamp__lte'] = int(date_to)
|
||||||
|
|
||||||
if user:
|
if user:
|
||||||
filter_kwargs["user"] = user
|
filter_kwargs["user__startswith"] = user
|
||||||
if asset:
|
if asset:
|
||||||
filter_kwargs['asset'] = asset
|
filter_kwargs['asset'] = asset
|
||||||
if system_user:
|
if system_user:
|
||||||
|
|
Loading…
Reference in New Issue