¼òµ¥ÐÞ¸Ä

pull/6/head
guanghongwei 2015-04-11 17:45:33 +08:00
parent 3c1af0e266
commit 12df8cf060
10 changed files with 24 additions and 40 deletions

View File

@ -22,7 +22,7 @@ root_pw = secret234
[websocket]
web_socket_host = 192.168.173.129:3000
web_socket_host = 192.168.20.209:3000
[web]

View File

@ -15,7 +15,7 @@ import subprocess
from django.core.paginator import Paginator, EmptyPage, InvalidPage
from django.http import HttpResponse, Http404
from juser.models import User, UserGroup, DEPT
from jasset.models import Asset, BisGroup
from jasset.models import Asset, BisGroup, IDC
from jlog.models import Log
from jasset.models import AssetAlias
from django.core.exceptions import ObjectDoesNotExist
@ -393,13 +393,10 @@ def validate(request, user_group=None, user=None, asset_group=None, asset=None,
if asset_group:
dept_asset_groups = dept.bisgroup_set.all()
asset_groups = []
for asset_group_name in dept_asset_groups:
asset_groups.extend(asset_group_name.name)
for group_id in asset_group:
asset_groups.extend(BisGroup.objects.filter(id=int(group_id)))
if len(asset_groups) == 0:
return False
if not set(asset_group).issubset(set(asset_groups)):
if not set(asset_groups).issubset(set(dept_asset_groups)):
return False
if asset:

View File

@ -6,7 +6,6 @@ from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import HttpResponseNotFound
from jperm.models import Apply
from multiprocessing import Pool
import paramiko
from jumpserver.api import *
@ -284,10 +283,13 @@ def filter_ajax_api(request):
def install(request):
from juser.models import DEPT, User
dept = DEPT(id=1, name="超管部", comment="超级管ç†å‘˜éƒ¨é—¨")
dept = DEPT(id=1, name="超管部", comment="SUPER DEPT")
dept.save()
dept2 = DEPT(id=2, name="默认", comment="默认部门")
dept2 = DEPT(id=2, name="默认", comment="DEFAULT DEPT")
dept2.save()
IDC(id=1, name="默认", comment="DEFAULT IDC").save()
BisGroup(id=1, name="ALL", dept=dept, comment="ALL USER GROUP").save()
User(id=5000, username="admin", password=md5_crypt('admin'),
name='admin', email='admin@jumpserver.org', role='SU', is_active=True, dept=dept).save()
User(id=5001, username="group_admin", password=md5_crypt('group_admin'),

View File

@ -204,7 +204,7 @@ def dept_list(request):
if keyword:
contact_list = DEPT.objects.filter(Q(name__icontains=keyword) | Q(comment__icontains=keyword)).order_by('name')
else:
contact_list = DEPT.objects.filter(id__gt=1)
contact_list = DEPT.objects.all().order_by('id')
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(contact_list, request)

View File

@ -125,6 +125,7 @@
$('#search').keyup(function() {
var $rows = $('#groups option');
console.log($rows);
var val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase();
$rows.show().filter(function() {

View File

@ -102,20 +102,6 @@
$('#editable').editableTableWidget();
});
$(".iframe").on('click', function(){
var url= $(this).attr("value");
$.layer({
type: 2,
title: 'JumpServer主机详情',
maxmin: true,
shift: 'top',
border: [2, 0.3, '#1AB394'],
shade: [0.5, '#000000'],
shadeClose: true,
area : ['800px' , '600px'],
iframe: {src: url}
});
});
function alter(form) {
selectData = GetTableDataBox();

View File

@ -99,7 +99,6 @@
<script>
$(document).ready(function(){
$(".iframe").colorbox({iframe:true, width:"70%", height:"70%"});
var check_array = []
$('#del_btn').click(function(){
if (confirm("确定删除")) {

View File

@ -91,7 +91,6 @@
<script>
$(document).ready(function(){
$(".iframe").colorbox({iframe:true, width:"70%", height:"70%"});
var check_array = []
$('#del_btn').click(function(){
if (confirm("确定删除")) {

View File

@ -27,11 +27,11 @@
<a><i class="fa fa-cube"></i> <span class="nav-label">资产管ç†</span><span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li class="host_add host_add_multi"><a href="/jasset/host_add/">添加资产</a></li>
<li class="host_list host_detail"><a href="/jasset/host_list/">查看资产&nbsp&nbsp</span><span class="label label-info pull-right">{{ host_active_num }}/{{ host_total_num}}</span></a></li>
<li class="host_list host_detail"><a href="/jasset/host_list/">查看资产<span class="label label-info pull-right">{{ host_active_num }}/{{ host_total_num}}</span></a></li>
<li class="idc_add"><a href="/jasset/idc_add/">添加IDC</a></li>
<li class="idc_list idc_detail idc_edit"><a href="/jasset/idc_list/">查看IDC</a></li>
<li class="group_add"><a href="/jasset/group_add/">添加主机组</a></li>
<li class="group_list group_detail"><a href="/jasset/group_list/">查看主机组</a></li>
<li class="idc_add"><a href="/jasset/idc_add/">添加IDC</a></li>
<li class="idc_list idc_detail"><a href="/jasset/idc_list/">查看IDC</a></li>
</ul>
</li>
<li id="jperm">
@ -41,11 +41,11 @@
<a href="/jperm/dept_perm_list/">部门授æƒ</a>
</li>
<li class="perm_list perm_edit">
<li class="perm_list perm_edit ">
<a href="/jperm/perm_list/">å°ç»„授æƒ</a>
</li>
<li class="sudo_list sudo_edit sudo_add cmd_list cmd_edit">
<li class="sudo_list sudo_edit sudo_add cmd_list cmd_edit cmd_add">
<a href="/jperm/sudo_list/">Sudo授æƒ</a>
</li>
<li class="apply_show online"><a href="/jperm/apply_show/online/">æƒé™å®¡æ‰¹</a></li>
@ -89,7 +89,7 @@
<li class="dept_list dept_edit"><a href="/juser/dept_list/">查看部门</a></li>
<li class="group_list group_edit"><a href="/juser/group_list/">查看å°ç»„</a></li>
<li class="group_add"><a href="/juser/group_add/">添加å°ç»„</a></li>
<li class="user_list"><a href="/juser/user_list/">查看用户<span class="label {% ifequal user_active_num user_total_num %}label-primary {% else %}label-warning {% endifequal %}pull-right">{{ user_active_num }}/{{ user_total_num }}</span></a></li>
<li class="user_list user_detail"><a href="/juser/user_list/">查看用户<span class="label {% ifequal user_active_num user_total_num %}label-primary {% else %}label-warning {% endifequal %}pull-right">{{ user_active_num }}/{{ user_total_num }}</span></a></li>
<li class="user_add"><a href="/juser/user_add/">添加用户</a></li>
</ul>
</li>
@ -97,20 +97,20 @@
<a><i class="fa fa-cube"></i> <span class="nav-label">资产管ç†</span><span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li class="host_add host_add_multi"><a href="/jasset/host_add/">添加资产</a></li>
<li class="host_list host_detail"><a href="/jasset/host_list/">查看资产&nbsp&nbsp</span><span class="label label-info pull-right">{{ host_active_num }}/{{ host_total_num}}</span></a></li>
<li class="host_list host_detail host_edit"><a href="/jasset/host_list/">查看资产<span class="label label-info pull-right">{{ host_active_num }}/{{ host_total_num}}</span></a></li>
<li class="idc_list idc_detail idc_edit"><a href="/jasset/idc_list/">查看IDC</a></li>
<li class="group_add"><a href="/jasset/group_add/">添加主机组</a></li>
<li class="group_list group_detail"><a href="/jasset/group_list/">查看主机组</a></li>
<li class="idc_list idc_detail"><a href="/jasset/idc_list/">查看IDC</a></li>
</ul>
</li>
<li id="jperm">
<a href="#"><i class="fa fa-edit"></i> <span class="nav-label">授æƒç®¡ç†</span><span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li id="perm_list">
<li class="perm_list perm_edit">
<a href="/jperm/perm_list/">å°ç»„授æƒ</a>
</li>
<li id="sudo_add">
<li class="sudo_list sudo_edit sudo_add cmd_list cmd_edit cmd_add">
<a href="/jperm/sudo_list/">Sudo授æƒ</a>
</li>
<li class="apply_show online"><a href="/jperm/apply_show/online/">æƒé™å®¡æ‰¹</a></li>

View File

@ -15,7 +15,7 @@
</span>
</a>
<ul class="dropdown-menu animated fadeInRight m-t-xs">
<li><a value="/juser/profile/?id={{ session_user_id }}" class="iframe">个人信æ¯</a></li>
<li><a value="/juser/profile/?id={{ session_user_id }}" class="iframe_user">个人信æ¯</a></li>
<li><a href="/juser/chg_info/">修改信æ¯</a></li>
<li><a href="/juser/chg_role/">切æ¢è§’色</a></li>
@ -29,7 +29,7 @@
</div>
</li>
<script>
$(".iframe").on('click', function(){
$(".iframe_user").on('click', function(){
var url= $(this).attr("value");
$.layer({
type: 2,