mirror of https://github.com/jumpserver/jumpserver
modify cmd_group num bug
parent
f7e70e56e3
commit
32ab051bbc
|
@ -30,5 +30,5 @@ web_socket_host = 192.168.40.140:3000
|
||||||
email_host = smtp.qq.com
|
email_host = smtp.qq.com
|
||||||
email_port = 25
|
email_port = 25
|
||||||
email_host_user = 1152704203@qq.com
|
email_host_user = 1152704203@qq.com
|
||||||
email_host_password = xxxxx
|
email_host_password = Hudie117...
|
||||||
email_use_tls = False
|
email_use_tls = False
|
||||||
|
|
|
@ -359,18 +359,12 @@ def sudo_cmd_count(user_group_id):
|
||||||
|
|
||||||
|
|
||||||
@register.filter(name='sudo_cmd_count')
|
@register.filter(name='sudo_cmd_count')
|
||||||
def sudo_cmd_count(user_group_id):
|
def sudo_cmd_count(cmd_group_id):
|
||||||
user_group = UserGroup.objects.filter(id=user_group_id)
|
cmd_group = CmdGroup.objects.filter(id=cmd_group_id)
|
||||||
cmds = []
|
cmds = []
|
||||||
if user_group:
|
if cmd_group:
|
||||||
user_group = user_group[0]
|
cmd_group = cmd_group[0]
|
||||||
cmd_groups = []
|
return len(set(cmd_group.cmd.split(',')))
|
||||||
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))
|
|
||||||
else:
|
else:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@
|
||||||
<i class="fa fa-linux"></i>
|
<i class="fa fa-linux"></i>
|
||||||
<b>{{ cmd_group.name }}</b>
|
<b>{{ cmd_group.name }}</b>
|
||||||
<br>
|
<br>
|
||||||
<small class="text-navy">共: {{ cmd_group.id|sudo_cmd_count }} 个</small>
|
<small class="text-navy">共: {{ cmd_group.id | sudo_cmd_count }} 个</small>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-7 content no-top-border">
|
<div class="col-xs-7 content no-top-border">
|
||||||
<p class="m-b-xs"><strong>{{ group.comment }}</strong></p>
|
<p class="m-b-xs"><strong>{{ group.comment }}</strong></p>
|
||||||
|
|
Loading…
Reference in New Issue