mirror of https://github.com/jumpserver/jumpserver
修改bug
parent
f592e46442
commit
46720dcf0f
|
@ -1,5 +1,6 @@
|
|||
import time
|
||||
from django import template
|
||||
from juser.models import User
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
@ -22,8 +23,9 @@ def get_value(dicts, key):
|
|||
return dicts.get(key, '')
|
||||
|
||||
@register.filter(name='groups_str')
|
||||
def groups_str(group_list):
|
||||
def groups_str(username):
|
||||
groups = []
|
||||
for group in group_list:
|
||||
user = User.objects.get(username=username)
|
||||
for group in user.user_group.all():
|
||||
groups.append(group.name)
|
||||
return ','.join(groups)
|
|
@ -304,7 +304,7 @@ def user_add(request):
|
|||
if LDAP_ENABLE:
|
||||
ldap_add_user(username, ldap_pwd)
|
||||
msg = u'添加用户 %s 成功!' % username
|
||||
locals = lambda: {}
|
||||
# locals = lambda: {}
|
||||
|
||||
except Exception, e:
|
||||
error = u'添加用户 %s 失败 %s ' % (username, e)
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
<td>{{ user.id }}</td>
|
||||
<td>{{ user.username }}</td>
|
||||
<td>{{ user.name }}</td>
|
||||
<td>{{ user.user_group.all|groups_str }}</td>
|
||||
<td>{{ user.username|groups_str }}</td>
|
||||
<td>{{ user_roler|get_value:user.role }}</td>
|
||||
<td>{{ user.email }}</td>
|
||||
<td>{{ user.is_active }}</td>
|
||||
|
|
Loading…
Reference in New Issue