From 1ea85c3b195ce0dfde4ec25704d98d99abf51624 Mon Sep 17 00:00:00 2001 From: guanghongwei Date: Thu, 18 Sep 2014 19:42:09 +0800 Subject: [PATCH] =?UTF-8?q?=E9=8F=87=E5=AD=98=E6=95=BC=E9=8F=84=E5=89=A7?= =?UTF-8?q?=E3=81=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webroot/AutoSa/AutoSa/views.py | 28 +++++++++++++------------- webroot/AutoSa/templates/showUser.html | 9 ++++++++- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/webroot/AutoSa/AutoSa/views.py b/webroot/AutoSa/AutoSa/views.py index b75652ff2..580afc1cd 100644 --- a/webroot/AutoSa/AutoSa/views.py +++ b/webroot/AutoSa/AutoSa/views.py @@ -305,24 +305,24 @@ def addUser(request): user_dn = "uid=%s,ou=People,%s" % (username, ldap_base_dn) userPassword = gen_sha512(keygen(6), ldap_password) - user_attr = {'uid': [str(username)], - 'cn': [str(username)], - 'objectClass': ['account', 'posixAccount', 'top', 'shadowAccount'], - 'userPassword': ['{crypt}%s' % userPassword], - 'shadowLastChange': ['16328'], - 'shadowMin': ['0'], - 'shadowMax': ['99999'], - 'shadowWarning': ['7'], - 'loginShell': ['/bin/bash'], - 'uidNumber': [str(u.id)], - 'gidNumber': [str(u.id)], - 'homeDirectory': [str('/home/%s' % username)] - } + user_attr = { + 'uid': [str(username)], + 'cn': [str(username)], + 'objectClass': ['account', 'posixAccount', 'top', 'shadowAccount'], + 'userPassword': ['{crypt}%s' % userPassword], + 'shadowLastChange': ['16328'], + 'shadowMin': ['0'], + 'shadowMax': ['99999'], + 'shadowWarning': ['7'], + 'loginShell': ['/bin/bash'], + 'uidNumber': [str(u.id)], + 'gidNumber': [str(u.id)], + 'homeDirectory': [str('/home/%s' % username)]} group_dn = "cn=%s,out=Group,%s" % (username, ldap_base_dn) group_attr = { 'objectClass': ['posixGroup', 'top'], - 'cn': [username], + 'cn': [str(username)], 'userPassword': ['{crypt}x'], 'gidNumber': [str(u.id)] } diff --git a/webroot/AutoSa/templates/showUser.html b/webroot/AutoSa/templates/showUser.html index 97c78ea28..fc9666b4c 100644 --- a/webroot/AutoSa/templates/showUser.html +++ b/webroot/AutoSa/templates/showUser.html @@ -26,8 +26,15 @@ {{ user.id }} {{ user.username }} - {{ user.group }} {{ user.name }} + + + {% for group in user.group.all() %} + {{ group.name }} + {% endfor} + + {{ user.is_admin }} + {{ user.is_superuser }} {{ user.email }} 下载