mirror of https://github.com/jumpserver/jumpserver
[Update] 修改获取common store
parent
3eaf4cd142
commit
f863ed0f4f
|
@ -343,6 +343,7 @@ defaults = {
|
|||
'TERMINAL_SESSION_KEEP_DURATION': 9999,
|
||||
'TERMINAL_HOST_KEY': '',
|
||||
'TERMINAL_TELNET_REGEX': '',
|
||||
'TERMINAL_COMMAND_STORAGE': {},
|
||||
'SECURITY_MFA_AUTH': False,
|
||||
'SECURITY_LOGIN_LIMIT_COUNT': 7,
|
||||
'SECURITY_LOGIN_LIMIT_TIME': 30,
|
||||
|
|
|
@ -519,12 +519,7 @@ DEFAULT_TERMINAL_COMMAND_STORAGE = {
|
|||
},
|
||||
}
|
||||
|
||||
TERMINAL_COMMAND_STORAGE = {
|
||||
# 'ali-es': {
|
||||
# 'TYPE': 'elasticsearch',
|
||||
# 'HOSTS': ['http://elastic:changeme@localhost:9200'],
|
||||
# },
|
||||
}
|
||||
TERMINAL_COMMAND_STORAGE = CONFIG.TERMINAL_COMMAND_STORAGE
|
||||
|
||||
DEFAULT_TERMINAL_REPLAY_STORAGE = {
|
||||
"default": {
|
||||
|
|
|
@ -67,7 +67,6 @@ class CommandViewSet(viewsets.ViewSet):
|
|||
|
||||
"""
|
||||
command_store = get_command_storage()
|
||||
multi_command_storage = get_multi_command_storage()
|
||||
serializer_class = SessionCommandSerializer
|
||||
permission_classes = (IsOrgAdminOrAppUser,)
|
||||
|
||||
|
@ -88,7 +87,8 @@ class CommandViewSet(viewsets.ViewSet):
|
|||
return Response({"msg": msg}, status=401)
|
||||
|
||||
def list(self, request, *args, **kwargs):
|
||||
queryset = self.multi_command_storage.filter()
|
||||
multi_command_storage = get_multi_command_storage()
|
||||
queryset = multi_command_storage.filter()
|
||||
serializer = self.serializer_class(queryset, many=True)
|
||||
return Response(serializer.data)
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@ from django import template
|
|||
from ..backends import get_multi_command_storage
|
||||
|
||||
register = template.Library()
|
||||
command_store = get_multi_command_storage()
|
||||
|
||||
|
||||
@register.filter
|
||||
def get_session_command_amount(session_id):
|
||||
command_store = get_multi_command_storage()
|
||||
return command_store.count(session=session_id)
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ __all__ = [
|
|||
'SessionDetailView',
|
||||
]
|
||||
|
||||
command_store = get_multi_command_storage()
|
||||
|
||||
|
||||
class SessionListView(AdminUserRequiredMixin, DatetimeSearchMixin, ListView):
|
||||
|
@ -108,6 +107,7 @@ class SessionDetailView(SingleObjectMixin, AdminUserRequiredMixin, ListView):
|
|||
return super().get(request, *args, **kwargs)
|
||||
|
||||
def get_queryset(self):
|
||||
command_store = get_multi_command_storage()
|
||||
return command_store.filter(session=self.object.id)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
|
|
Loading…
Reference in New Issue