Commit 6a8db896 authored by guanghongwei's avatar guanghongwei

޸һbug

parent 5cd09a65
...@@ -8,11 +8,7 @@ password = mysql234 ...@@ -8,11 +8,7 @@ password = mysql234
database = jumpserver database = jumpserver
[ldap] [ldap]
host_url = ldap://192.168.8.60:389 ldap_enable = 1
base_dn = dc=fengxing,dc=org
root_dn = cn=admin,dc=fengxing,dc=org
root_pw = 123456
ldap_enable = 0
host_url = ldap://127.0.0.1:389 host_url = ldap://127.0.0.1:389
base_dn = dc=jumpserver,dc=org base_dn = dc=jumpserver,dc=org
root_dn = cn=admin,dc=jumpserver,dc=org root_dn = cn=admin,dc=jumpserver,dc=org
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
import time import time
from django import template from django import template
from django.db.models import Q from django.db.models import Q
from juser.models import User from juser.models import User, UserGroup
register = template.Library() register = template.Library()
...@@ -56,6 +56,12 @@ def perm_count(user_id): ...@@ -56,6 +56,12 @@ def perm_count(user_id):
return user.perm_set.all().count() return user.perm_set.all().count()
@register.filter(name='member_count')
def member_count(group_id):
group = UserGroup.objects.get(id=group_id)
return group.user_set.count()
@register.filter(name='group_type_to_str') @register.filter(name='group_type_to_str')
def group_type_to_str(type_name): def group_type_to_str(type_name):
group_types = { group_types = {
...@@ -63,5 +69,4 @@ def group_type_to_str(type_name): ...@@ -63,5 +69,4 @@ def group_type_to_str(type_name):
'M': '管理组', 'M': '管理组',
'A': '授权组', 'A': '授权组',
} }
return group_types.get(type_name) return group_types.get(type_name)
This diff is collapsed.
...@@ -36,10 +36,10 @@ ...@@ -36,10 +36,10 @@
<table class="table table-striped table-bordered table-hover " id="editable" > <table class="table table-striped table-bordered table-hover " id="editable" >
<thead> <thead>
<tr> <tr>
<th class="text-center"><input type="checkbox" class="i-checks" name=""></th>
<th class="text-center">ID</th> <th class="text-center">ID</th>
<th class="text-center">组名</th> <th class="text-center">组名</th>
<th class="text-center">类型</th> <th class="text-center">类型</th>
<th class="text-center">成员数量</th>
<th class="text-center">备注</th> <th class="text-center">备注</th>
<th class="text-center">操作</th> <th class="text-center">操作</th>
</tr> </tr>
...@@ -47,10 +47,10 @@ ...@@ -47,10 +47,10 @@
<tbody> <tbody>
{% for group in contacts.object_list %} {% for group in contacts.object_list %}
<tr class="gradeX"> <tr class="gradeX">
<td class="text-center"><input type="checkbox" class="i-checks" name=""></td>
<td class="text-center"> {{ group.id }} </td> <td class="text-center"> {{ group.id }} </td>
<td class="text-center"> {{ group.name }} </td> <td class="text-center"> {{ group.name }} </td>
<td class="text-center"> {{ group.type|group_type_to_str }} </td> <td class="text-center"> {{ group.type|group_type_to_str }} </td>
<td class="text-center"> {{ group.id|member_count }} </td>
<td class="text-center"> {{ group.comment }} </td> <td class="text-center"> {{ group.comment }} </td>
<td class="text-center"> <td class="text-center">
<a href="../group_detail/?id={{ group.id }}" class="iframe btn btn-xs btn-primary">成员</a> <a href="../group_detail/?id={{ group.id }}" class="iframe btn btn-xs btn-primary">成员</a>
......
...@@ -73,19 +73,19 @@ ...@@ -73,19 +73,19 @@
<div class="form-group"> <div class="form-group">
<label for="groups" class="col-lg-2 control-label">属组<span class="red-fonts">*</span></label> <label for="groups" class="col-lg-2 control-label">属组<span class="red-fonts">*</span></label>
<div class="col-sm-8"> <div class="col-sm-8">
<select id="groups" name="groups" class="form-control m-b" multiple> <select id="groups" name="groups" class="form-control m-b" multiple size="10">
{% for group in all_group %} {% for group in all_group %}
{% if groups_str %} {% if groups_str %}
{% if group.id|int2str in groups_str %} {% if group.id|int2str in groups_str %}
<option value="{{ group.id }}" selected>{{ group.name }}</option> <option value="{{ group.id }}" selected>{{ group.name }} --- {{ group.type|group_type_to_str }}</option>
{% else %} {% else %}
<option value="{{ group.id }}">{{ group.name }}</option> <option value="{{ group.id }}">{{ group.name }} --- {{ group.type|group_type_to_str }}</option>
{% endif %} {% endif %}
{% else %} {% else %}
{% if forloop.first %} {% if forloop.first %}
<option value="{{ group.id }}" selected>{{ group.name }}</option> <option value="{{ group.id }}" selected>{{ group.name }} --- {{ group.type|group_type_to_str }}</option>
{% else %} {% else %}
<option value="{{ group.id }}">{{ group.name }}</option> <option value="{{ group.id }}">{{ group.name }} --- {{ group.type|group_type_to_str }}</option>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
......
...@@ -16,9 +16,6 @@ ...@@ -16,9 +16,6 @@
<div class="contact-box"> <div class="contact-box">
<h2 class="text-center">{{ user.name }} 用户详情</h2> <h2 class="text-center">{{ user.name }} 用户详情</h2>
<div class="ibox-content"> <div class="ibox-content">
<div class="">
<a target="_blank" href="/juser/user_add/" class="btn btn-sm btn-primary "> 添加 </a>
</div>
<table class="table table-striped table-bordered table-hover " id="editable" > <table class="table table-striped table-bordered table-hover " id="editable" >
<thead> <thead>
...@@ -58,7 +55,7 @@ ...@@ -58,7 +55,7 @@
</tr> </tr>
<tr class="gradeX"> <tr class="gradeX">
<td class="text-center">添加时间</td> <td class="text-center">添加时间</td>
<td class="text-center">{{ user.joined }}</td> <td class="text-center">{{ user.date_joined|stamp2str }}</td>
</tr> </tr>
<tr class="gradeX"> <tr class="gradeX">
<td class="text-center">最后登录</td> <td class="text-center">最后登录</td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment