mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-08-16 21:28:11 +00:00
perf: User report
This commit is contained in:
parent
4810eae725
commit
4326d35065
@ -19,6 +19,7 @@
|
||||
"AccountBackupTask": "Account backup task | Account backup tasks",
|
||||
"AccountBackupUpdate": "Update account backup",
|
||||
"AccountChangeSecret": "Account change secret",
|
||||
"UserLoginTrends": "User login trend",
|
||||
"AccountChangeSecretDetail": "Change account secret details",
|
||||
"AccountConnectivityStatusDistribution": "Account connectivity status distribution",
|
||||
"AccountCreationSourceDistribution": "Account creation source distribution",
|
||||
|
@ -1129,6 +1129,7 @@
|
||||
"RequiredSystemUserErrMsg": "请选择账号",
|
||||
"RequiredUploadFile": "请上传文件!",
|
||||
"Reset": "还原",
|
||||
"UserLoginTrends": "用户登录趋势",
|
||||
"ResetAndDownloadSSHKey": "重置并下载密钥",
|
||||
"ResetMFA": "重置MFA",
|
||||
"ResetMFAWarningMsg": "你确定要重置用户的 MFA 吗?",
|
||||
|
@ -6,7 +6,7 @@ from django.db.models import Count, Q
|
||||
from django.http import JsonResponse
|
||||
from rest_framework.views import APIView
|
||||
|
||||
from assets.const import AllTypes, Connectivity
|
||||
from assets.const import AllTypes, Connectivity, Category
|
||||
from assets.models import Asset, Platform
|
||||
from common.permissions import IsValidLicense
|
||||
from common.utils import lazyproperty
|
||||
@ -50,15 +50,16 @@ class AssetStatisticApi(DateRangeMixin, APIView):
|
||||
directory_services=Count(1, filter=Q(directory_services__isnull=False)),
|
||||
)
|
||||
|
||||
type_category_map = {
|
||||
d['value']: str(d['category'].label)
|
||||
for d in AllTypes.types()
|
||||
}
|
||||
category_map = Category.as_dict()
|
||||
|
||||
category_type_map = defaultdict(list)
|
||||
for d in AllTypes.types():
|
||||
category_type_map[str(d['category'].label)].append(d['value'])
|
||||
|
||||
category_type_ids = defaultdict(lambda: defaultdict(set))
|
||||
for _id, tp, category in (qs.select_related('platform')
|
||||
.values_list('id', 'platform__type', 'platform__category')):
|
||||
category_label = type_category_map.get(tp, 'Other')
|
||||
category_label = category_map.get(category, category)
|
||||
category_type_ids[category_label][tp].add(_id)
|
||||
|
||||
by_type_category = defaultdict(list)
|
||||
|
@ -22,7 +22,7 @@ __all__ = ['UserReportApi']
|
||||
class UserReportApi(DateRangeMixin, APIView):
|
||||
http_method_names = ['get']
|
||||
rbac_perms = {
|
||||
'GET': 'users.view_users',
|
||||
'GET': 'users.view_user',
|
||||
}
|
||||
permission_classes = [RBACPermission, IsValidLicense]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user