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