diff --git a/jumpserver.conf b/jumpserver.conf index c9f53f810..618d76f14 100644 --- a/jumpserver.conf +++ b/jumpserver.conf @@ -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] diff --git a/jumpserver/api.py b/jumpserver/api.py index 6130d36a5..688a7d446 100644 --- a/jumpserver/api.py +++ b/jumpserver/api.py @@ -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: diff --git a/jumpserver/views.py b/jumpserver/views.py index 81bd808a3..1b7348508 100644 --- a/jumpserver/views.py +++ b/jumpserver/views.py @@ -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'), diff --git a/juser/views.py b/juser/views.py index abda8dc25..ad3bf4405 100644 --- a/juser/views.py +++ b/juser/views.py @@ -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) diff --git a/templates/jasset/group_add.html b/templates/jasset/group_add.html index b7c42d7cb..37303ce38 100644 --- a/templates/jasset/group_add.html +++ b/templates/jasset/group_add.html @@ -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() { diff --git a/templates/jasset/host_list.html b/templates/jasset/host_list.html index 7364e0a3e..c21f6e260 100644 --- a/templates/jasset/host_list.html +++ b/templates/jasset/host_list.html @@ -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(); diff --git a/templates/juser/dept_list.html b/templates/juser/dept_list.html index 0af74f7ea..944fa951e 100644 --- a/templates/juser/dept_list.html +++ b/templates/juser/dept_list.html @@ -99,7 +99,6 @@