mirror of https://github.com/jumpserver/jumpserver
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
826 B
33 lines
826 B
# -*- coding: utf-8 -*-
|
|
#
|
|
|
|
from .base import CommandBase
|
|
|
|
|
|
class CommandStore(CommandBase):
|
|
def __init__(self, storage_list):
|
|
self.storage_list = storage_list
|
|
|
|
def filter(self, **kwargs):
|
|
if len(self.storage_list) == 1:
|
|
storage = list(self.storage_list)[0]
|
|
queryset = storage.filter(**kwargs)
|
|
return queryset
|
|
|
|
queryset = []
|
|
for storage in self.storage_list:
|
|
queryset.extend(storage.filter(**kwargs))
|
|
return sorted(queryset, key=lambda command: command.timestamp, reverse=True)
|
|
|
|
def count(self, **kwargs):
|
|
amount = 0
|
|
for storage in self.storage_list:
|
|
amount += storage.count(**kwargs)
|
|
return amount
|
|
|
|
def save(self, command):
|
|
pass
|
|
|
|
def bulk_save(self, commands):
|
|
pass
|