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