diff --git a/jumpserver.conf b/jumpserver.conf index c4d294679..49f135076 100644 --- a/jumpserver.conf +++ b/jumpserver.conf @@ -30,5 +30,5 @@ web_socket_host = 192.168.40.140:3000 email_host = smtp.qq.com email_port = 25 email_host_user = 1152704203@qq.com -email_host_password = xxxxx +email_host_password = Hudie117... email_use_tls = False diff --git a/jumpserver/templatetags/mytags.py b/jumpserver/templatetags/mytags.py index ee2f05c13..6f7567b51 100644 --- a/jumpserver/templatetags/mytags.py +++ b/jumpserver/templatetags/mytags.py @@ -359,18 +359,12 @@ def sudo_cmd_count(user_group_id): @register.filter(name='sudo_cmd_count') -def sudo_cmd_count(user_group_id): - user_group = UserGroup.objects.filter(id=user_group_id) +def sudo_cmd_count(cmd_group_id): + cmd_group = CmdGroup.objects.filter(id=cmd_group_id) cmds = [] - if user_group: - user_group = user_group[0] - cmd_groups = [] - for perm in user_group.sudoperm_set.all(): - cmd_groups.extend(perm.cmd_group.all()) - - for cmd_group in cmd_groups: - cmds.extend(cmd_group.cmd.split(',')) - return len(set(cmds)) + if cmd_group: + cmd_group = cmd_group[0] + return len(set(cmd_group.cmd.split(','))) else: return 0 diff --git a/templates/jperm/sudo_detail.html b/templates/jperm/sudo_detail.html index c732a4b37..1f547d8c2 100644 --- a/templates/jperm/sudo_detail.html +++ b/templates/jperm/sudo_detail.html @@ -143,7 +143,7 @@ {{ cmd_group.name }}
- 共: {{ cmd_group.id|sudo_cmd_count }} 个 + 共: {{ cmd_group.id | sudo_cmd_count }} 个

{{ group.comment }}