mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-10-23 00:38:39 +00:00
@@ -2,43 +2,18 @@
|
||||
#
|
||||
import os
|
||||
|
||||
from django.core.cache import cache
|
||||
from django.conf import settings
|
||||
from django.core.files.storage import default_storage
|
||||
import jms_storage
|
||||
|
||||
from assets.models import Asset, SystemUser
|
||||
from users.models import User
|
||||
from common.utils import get_logger
|
||||
from .const import USERS_CACHE_KEY, ASSETS_CACHE_KEY, SYSTEM_USER_CACHE_KEY
|
||||
|
||||
from .backends import server_replay_storage
|
||||
from .models import ReplayStorage
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
def get_session_asset_list():
|
||||
return Asset.objects.values_list('hostname', flat=True)
|
||||
|
||||
|
||||
def get_session_user_list():
|
||||
return User.objects.exclude(role=User.ROLE.APP).values_list('username', flat=True)
|
||||
|
||||
|
||||
def get_session_system_user_list():
|
||||
return SystemUser.objects.values_list('username', flat=True)
|
||||
|
||||
|
||||
def get_user_list_from_cache():
|
||||
return cache.get(USERS_CACHE_KEY)
|
||||
|
||||
|
||||
def get_asset_list_from_cache():
|
||||
return cache.get(ASSETS_CACHE_KEY)
|
||||
|
||||
|
||||
def get_system_user_list_from_cache():
|
||||
return cache.get(SYSTEM_USER_CACHE_KEY)
|
||||
|
||||
|
||||
def find_session_replay_local(session):
|
||||
# 新版本和老版本的文件后缀不同
|
||||
session_path = session.get_rel_replay_path() # 存在外部存储上的路径
|
||||
@@ -62,6 +37,8 @@ def download_session_replay(session):
|
||||
for storage in replay_storages
|
||||
if not storage.in_defaults()
|
||||
}
|
||||
if settings.SERVER_REPLAY_STORAGE:
|
||||
configs['SERVER_REPLAY_STORAGE'] = settings.SERVER_REPLAY_STORAGE
|
||||
if not configs:
|
||||
msg = "Not found replay file, and not remote storage set"
|
||||
return None, msg
|
||||
|
Reference in New Issue
Block a user