[Update] 修改command搜索

pull/2882/head^2
ibuler 2019-07-04 16:28:42 +08:00
parent 858c7df86b
commit 5b1ee67820
2 changed files with 11 additions and 3 deletions

View File

@ -26,14 +26,22 @@ class CommandQueryMixin:
pagination_class = LimitOffsetPagination
permission_classes = [IsOrgAdminOrAppUser | IsAuditor]
filter_fields = [
"asset", "system_user", "user", "input", "session",
"asset", "system_user", "user", "session",
]
default_days_ago = 5
def get_queryset(self):
date_from, date_to = self.get_date_range()
q = self.request.query_params
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
def get_filter_fields(self):

View File

@ -80,7 +80,7 @@ class CommandStore(CommandBase):
filter_kwargs['timestamp__lte'] = int(date_to)
if user:
filter_kwargs["user"] = user
filter_kwargs["user__startswith"] = user
if asset:
filter_kwargs['asset'] = asset
if system_user: