2015-04-20 02:12:11 +00:00
|
|
|
{% extends 'base.html' %}
|
|
|
|
{% load mytags %}
|
|
|
|
|
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
{% include 'nav_cat_bar.html' %}
|
|
|
|
<div class="wrapper wrapper-content animated fadeInRight">
|
|
|
|
<div class="row">
|
2015-12-19 09:26:34 +00:00
|
|
|
<div class="col-sm-4">
|
2015-04-20 02:12:11 +00:00
|
|
|
<div class="ibox float-e-margins">
|
|
|
|
<div class="ibox-title">
|
|
|
|
<span class="label label-primary"><b>{{ user.name }}</b></span>
|
|
|
|
<div class="ibox-tools">
|
|
|
|
<a class="collapse-link">
|
|
|
|
<i class="fa fa-chevron-up"></i>
|
|
|
|
</a>
|
|
|
|
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
|
|
|
<i class="fa fa-wrench"></i>
|
|
|
|
</a>
|
|
|
|
<ul class="dropdown-menu dropdown-user">
|
|
|
|
<li><a href="#"></a>
|
|
|
|
</li>
|
|
|
|
<li><a href="#"></a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<a class="close-link">
|
|
|
|
<i class="fa fa-times"></i>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="ibox-content">
|
|
|
|
<div>
|
|
|
|
<div class="text-left">
|
|
|
|
<table class="table">
|
|
|
|
<tr>
|
|
|
|
<td class="text-navy">ID</td>
|
|
|
|
<td>{{ user.id }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="text-navy">用户名</td>
|
|
|
|
<td>{{ user.username }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="text-navy">姓名</td>
|
|
|
|
<td>{{ user.name }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2015-12-19 09:26:34 +00:00
|
|
|
<td class="text-navy">权限</td>
|
2015-04-20 02:12:11 +00:00
|
|
|
<td>{{ user.id | get_role }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2015-12-19 09:26:34 +00:00
|
|
|
<td class="text-navy">key</td>
|
|
|
|
{% if user.username|key_exist %}
|
|
|
|
<td><a href="{% url 'key_down' %}?id={{ user.id }}" >下载</a></td>
|
|
|
|
{% else %}
|
|
|
|
<td><span style="color: #586b7d">NoKey</span></td>
|
|
|
|
{% endif %}
|
2015-04-20 02:12:11 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="text-navy">Email</td>
|
|
|
|
<td>{{ user.email }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="text-navy">激活</td>
|
|
|
|
<td>{{ user.is_active|bool2str }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="text-navy">添加日期</td>
|
|
|
|
<td>{{ user.date_joined|date:"Y-m-d H:i:s" }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="text-navy">最后登录</td>
|
|
|
|
<td>{{ user.last_login|date:"Y-m-d H:i:s" }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="text-navy">所在用户组</td>
|
|
|
|
<td>
|
|
|
|
<table class="table">
|
|
|
|
{% for group in user.group.all %}
|
|
|
|
<tr>
|
2015-12-19 09:26:34 +00:00
|
|
|
<td><a href="{% url 'user_group_list' %}?id={{ group.id }}">{{ group.name }}</a></td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</table>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="text-navy">授权主机数量</td>
|
|
|
|
<td>
|
|
|
|
{{ user_perm_info.asset.keys | length }}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="text-navy">授权主机组</td>
|
|
|
|
<td>
|
|
|
|
<table class="table">
|
|
|
|
{% for group in user_perm_info.asset_group.keys%}
|
|
|
|
<tr>
|
|
|
|
<td><a href="{% url 'user_group_list' %}?id={{ group.id }}">{{ group.name }}</a></td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</table>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="text-navy">授权规则</td>
|
|
|
|
<td>
|
|
|
|
<table class="table">
|
|
|
|
{% for rule in user_perm_info.rule%}
|
|
|
|
<tr>
|
|
|
|
<td><a href="{% url 'role_list' %}?id={{ rule.id }}">{{ rule.name }}</a></td>
|
2015-04-20 02:12:11 +00:00
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</table>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2015-12-19 09:26:34 +00:00
|
|
|
<div class="col-sm-4">
|
2015-04-20 02:12:11 +00:00
|
|
|
<div class="ibox float-e-margins">
|
|
|
|
<div class="ibox-title">
|
|
|
|
<h5>授权主机/组</h5>
|
|
|
|
<div class="ibox-tools">
|
|
|
|
<a class="collapse-link">
|
|
|
|
<i class="fa fa-chevron-up"></i>
|
|
|
|
</a>
|
|
|
|
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
|
|
|
<i class="fa fa-wrench"></i>
|
|
|
|
</a>
|
|
|
|
<ul class="dropdown-menu dropdown-user">
|
|
|
|
</ul>
|
|
|
|
<a class="close-link">
|
|
|
|
<i class="fa fa-times"></i>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="ibox-content ibox-heading">
|
|
|
|
<h3>用户的所有授权主机</h3>
|
2015-12-19 09:26:34 +00:00
|
|
|
<small><i class="fa fa-map-marker"></i> 这里包含了用户授权的主机和其映射的系统用户.</small>
|
2015-04-20 02:12:11 +00:00
|
|
|
</div>
|
|
|
|
<div class="ibox-content inspinia-timeline">
|
2015-12-19 09:26:34 +00:00
|
|
|
{% for role, assets in role_assets.items %}
|
2015-04-20 02:12:11 +00:00
|
|
|
<div class="timeline-item">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-xs-3 date">
|
2015-12-19 09:26:34 +00:00
|
|
|
<i class="fa fa-info"></i>
|
|
|
|
<b>
|
|
|
|
<a href="{% url 'role_list' %}?id={{ role.id }}">{{ role.name }}</a></b>
|
2015-04-20 02:12:11 +00:00
|
|
|
<br>
|
2015-12-19 09:26:34 +00:00
|
|
|
<small class="text-navy">共: {{ assets.asset | length }}台</small>
|
2015-04-20 02:12:11 +00:00
|
|
|
</div>
|
|
|
|
<div class="col-xs-7 content no-top-border">
|
2015-12-19 09:26:34 +00:00
|
|
|
<p class="m-b-xs">
|
|
|
|
<strong>{{ role.comment }}</strong>
|
|
|
|
</p>
|
2015-04-20 02:12:11 +00:00
|
|
|
<p>
|
2015-12-19 09:26:34 +00:00
|
|
|
{% for asset in assets.asset %}
|
|
|
|
<a href="{% url 'asset_list' %}?id={{ asset.id }}">{{ asset.hostname }}</a><br>
|
2015-04-20 02:12:11 +00:00
|
|
|
{% endfor %}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
2015-12-19 09:26:34 +00:00
|
|
|
{% ifequal '{{ asset.asset | length }}' 0 %}
|
2015-04-20 02:12:11 +00:00
|
|
|
(无)
|
2015-12-19 09:26:34 +00:00
|
|
|
{% endifequal %}
|
2015-04-20 02:12:11 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2015-12-19 09:26:34 +00:00
|
|
|
<div class="col-sm-4">
|
2015-04-20 02:12:11 +00:00
|
|
|
<div class="ibox float-e-margins">
|
|
|
|
<div class="ibox-title">
|
|
|
|
<h5>登录记录</h5>
|
|
|
|
<div class="ibox-tools">
|
|
|
|
<span class="label label-warning-light">最近登录</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="ibox-content">
|
|
|
|
<div id="last">
|
2015-12-19 09:26:34 +00:00
|
|
|
|
2015-04-20 02:12:11 +00:00
|
|
|
<div class="feed-activity-list" >
|
2015-12-19 09:26:34 +00:00
|
|
|
{% for log in user_log_ten %}
|
2015-04-20 02:12:11 +00:00
|
|
|
<div class="feed-element">
|
|
|
|
<a href="profile.html" class="pull-left">
|
|
|
|
<img alt="image" class="img-circle" src="/static/img/{{ session_role_id | to_avatar }}.png">
|
|
|
|
</a>
|
|
|
|
<div class="media-body ">
|
2015-12-19 09:26:34 +00:00
|
|
|
{# <small class="pull-right">{{ log.start_time|time_delta }}</small>#}
|
|
|
|
<small class="pull-right">{{ log.start_time }}</small>
|
2015-04-20 02:12:11 +00:00
|
|
|
<strong>{{ log.user }}</strong> 登录了 <span class="text-navy">{{ log.host }}. </span><br>
|
|
|
|
<small class="text-muted">{{ log.start_time|date:"Y-m-d H:i:s" }}</small>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
2015-12-19 09:26:34 +00:00
|
|
|
{% if not user_log_ten %}
|
2015-04-20 02:12:11 +00:00
|
|
|
(暂无)
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
2015-12-19 09:26:34 +00:00
|
|
|
{% if user_log_last_num > 10 %}
|
|
|
|
<button id="show" class="btn btn-primary btn-block m-t"><i class="fa fa-arrow-down"></i> Show More</button>
|
2015-04-20 02:12:11 +00:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="all" style="display: none">
|
|
|
|
<div class="feed-activity-list" >
|
2015-12-19 09:26:34 +00:00
|
|
|
{% for log in user_log_last %}
|
2015-04-20 02:12:11 +00:00
|
|
|
<div class="feed-element">
|
|
|
|
<a href="profile.html" class="pull-left">
|
|
|
|
<img alt="image" class="img-circle" src="/static/img/{{ session_role_id | to_avatar }}.png">
|
|
|
|
</a>
|
|
|
|
<div class="media-body ">
|
2015-12-19 09:26:34 +00:00
|
|
|
<small class="pull-right">{{ log.start_time }}</small>
|
|
|
|
{# <small class="pull-right">{{ log.start_time|time_delta }}</small>#}
|
2015-04-20 02:12:11 +00:00
|
|
|
<strong>{{ log.user }}</strong> 登录了 <span class="text-navy">{{ log.host }}. </span><br>
|
|
|
|
<small class="text-muted">{{ log.start_time|date:"Y-m-d H:i:s" }}</small>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
$(document).ready(function(){
|
|
|
|
$('#show').click(function(){
|
|
|
|
$('#last').css('display', 'none');
|
|
|
|
$('#all').css('display', 'block');
|
|
|
|
})
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
{% endblock %}
|