pull/26/head
ibuler 9 years ago
parent cb12b83e47
commit 5be2633795

@ -195,9 +195,9 @@ def get_display_msg(user, password, ssh_key_pwd, ssh_key_login_need, send_mail_n
用户名%s
密码%s
密钥密码%s
密钥下载url: %s/juser/down_key/?id=%s
密钥下载url: %s/juser/down_key/?uuid=%s
该账号密码可以登陆web和跳板机
""" % (URL, user.username, password, ssh_key_pwd, URL, user.id)
""" % (URL, user.username, password, ssh_key_pwd, URL, user.uuid)
else:
msg = u"""
跳板机地址 %s \n

@ -13,15 +13,6 @@ from jperm.perm_api import get_group_user_perm
MAIL_FROM = EMAIL_HOST_USER
@login_required(login_url='/login')
def chg_role(request):
role = {'SU': 2, 'GA': 1, 'CU': 0}
if request.session['role_id'] > 0:
request.session['role_id'] = 0
elif request.session['role_id'] == 0:
request.session['role_id'] = role.get(request.user.role, 0)
return HttpResponseRedirect('/')
@require_role(role='super')
def group_add(request):
@ -128,7 +119,6 @@ def group_edit(request):
continue
user.group.add(g)
except ServerError, e:
error = e
if not error:
@ -141,7 +131,6 @@ def group_edit(request):
return my_render('juser/group_edit.html', locals(), request)
@login_required(login_url='/login')
@require_role(role='super')
def user_add(request):
error = ''
@ -307,6 +296,7 @@ def forget_password(request):
return render_to_response('juser/forget_password.html', locals())
@require_role('user')
def reset_password(request):
uuid_r = request.GET.get('uuid', '')
timestamp = request.GET.get('timestamp', '')
@ -401,14 +391,11 @@ def user_edit(request):
def profile(request):
a = request.user.id
a = request.user.groups
user_id = request.user.id
if not user_id:
return HttpResponseRedirect('/')
user = User.objects.get(id=user_id)
return render_to_response('juser/profile.html', locals(), context_instance=RequestContext(request))
return my_render('juser/profile.html', locals(), request)
def change_info(request):
@ -440,7 +427,7 @@ def change_info(request):
user.save()
msg = '修改成功'
return render_to_response('juser/change_info.html', locals(), context_instance=RequestContext(request))
return my_render('juser/change_info.html', locals(), request)
@require_role(role='user')
@ -467,7 +454,8 @@ def down_key(request):
user = get_object(User, uuid=uuid_r)
if user:
username = user.username
private_key_file = os.path.join(KEY_DIR, 'user', username)
private_key_file = os.path.join(KEY_DIR, 'user', username+'pem')
print private_key_file
if os.path.isfile(private_key_file):
f = open(private_key_file)
data = f.read()

@ -26,21 +26,16 @@
<td class="text-center">角色</td>
<td class="text-center">Email</td>
<td class="text-center">激活</td>
{# <td class="text-center">添加时间</td>#}
{# <td class="text-center">最后登录</td>#}
</tr>
</thead>
<tbody>
<tr class="gradeX">
<td class="text-center">{{ user.id }}</td>
<td class="text-center">{{ user.username }}</td>
<td class="text-center">{{ user.name }}</td>
<td class="text-center">{{ user.id | get_role }}</td>
<td class="text-center">{{ user.email }}</td>
<td class="text-center">{{ user.is_active|bool2str }}</td>
{# <td class="text-center">{{ user.date_joined }}</td>#}
{# <td class="text-center">{{ user.last_login }}</td>#}
</tr>
<tr>
<td class="text-center">添加日期: </td>
@ -56,23 +51,6 @@
{% endfor %}
</td>
</tr>
{# <tr>#}
{# <td colspan="1" class="text-center">授权主机组:</td>#}
{# <td colspan="6" class="text-center">#}
{# {% for group in user|get_user_asset_group %}#}
{# <b>{{ group.name }}</b>#}
{# {% endfor %}#}
{# </td>#}
{# </tr>#}
{# #}
{# <tr class="gradeX">#}
{# <td class="text-center">授权主机组</td>#}
{# <td class="text-center">#}
{# {% for asset_group in asset_group_permed %}#}
{# {{ asset_group.name }}#}
{# {% endfor %}#}
{# </td>#}
{# </tr>#}
</table>
</div>
</div>

@ -42,7 +42,7 @@
<thead>
<tr>
<th class="text-center">
<input type="checkbox" id="check_all" onclick="checkAll()">
<input type="checkbox" id="check_all" onclick="checkAll('check_all', 'checked')">
</th>
<th class="text-center">用户名</th>
<th class="text-center">姓名</th>

Loading…
Cancel
Save