forked from jumpserver/jumpserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
35 lines (18 loc) · 733 Bytes
/
Copy pathutils.py
File metadata and controls
35 lines (18 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# -*- coding: utf-8 -*-
#
from django.core.cache import cache
from assets.models import Asset, SystemUser
from users.models import User
from .const import USERS_CACHE_KEY, ASSETS_CACHE_KEY, SYSTEM_USER_CACHE_KEY
def get_session_asset_list():
return Asset.objects.values_list('hostname', flat=True)
def get_session_user_list():
return User.objects.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)