mirror of https://github.com/jumpserver/jumpserver
merge with wangyong
commit
8f66de365e
|
@ -3,7 +3,6 @@ from django.conf.urls import patterns, include, url
|
|||
from jasset.views import *
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^$', index),
|
||||
url(r'^host_add/$', add_host),
|
||||
url(r"^host_add_multi/$", add_host_multi),
|
||||
url(r'^host_list/$', list_host),
|
||||
|
@ -23,5 +22,4 @@ urlpatterns = patterns('',
|
|||
url(r'^host_del/(\w+)/$', host_del),
|
||||
url(r'^host_edit/$', host_edit),
|
||||
url(r'^host_edit/batch/$', batch_host_edit),
|
||||
url(r'^test/$', test),
|
||||
)
|
|
@ -3,6 +3,7 @@
|
|||
import ast
|
||||
|
||||
from django.db.models import Q
|
||||
from django.http import Http404
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.template import RequestContext
|
||||
from django.shortcuts import render_to_response
|
||||
|
@ -12,15 +13,13 @@ from juser.models import UserGroup, DEPT
|
|||
from connect import PyCrypt, KEY
|
||||
from jlog.models import Log
|
||||
from jumpserver.views import jasset_host_edit, pages
|
||||
from jumpserver.api import asset_perm_api
|
||||
from jumpserver.api import user_perm_group_api, require_login, require_super_user, \
|
||||
require_admin, is_group_admin, is_super_user, is_common_user, get_user_dept
|
||||
from jumpserver.api import *
|
||||
|
||||
cryptor = PyCrypt(KEY)
|
||||
|
||||
|
||||
def index(request):
|
||||
return render_to_response('jasset/jasset.html', )
|
||||
class RaiseError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def f_add_host(ip, port, idc, jtype, group, dept, active, comment, username='', password=''):
|
||||
|
@ -70,6 +69,7 @@ def add_host(request):
|
|||
user_id = request.session.get('user_id')
|
||||
edept = DEPT.objects.get(id=dept_id)
|
||||
egroup = edept.bisgroup_set.all()
|
||||
|
||||
if request.method == 'POST':
|
||||
j_ip = request.POST.get('j_ip')
|
||||
j_idc = request.POST.get('j_idc')
|
||||
|
@ -80,6 +80,10 @@ def add_host(request):
|
|||
j_comment = request.POST.get('j_comment')
|
||||
j_dept = request.POST.getlist('j_dept')
|
||||
|
||||
if is_group_admin(request) and not validate(request, asset_group=j_group, edept=j_dept):
|
||||
emg = u'添加失败,您无权操作!'
|
||||
return render_to_response('jasset/host_add.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
if Asset.objects.filter(ip=str(j_ip)):
|
||||
emg = u'该IP %s 已存在!' % j_ip
|
||||
return render_to_response('jasset/host_add.html', locals(), context_instance=RequestContext(request))
|
||||
|
@ -136,6 +140,7 @@ def batch_host_edit(request):
|
|||
j_id = "editable[" + str(i) + "][j_id]"
|
||||
j_ip = "editable[" + str(i) + "][j_ip]"
|
||||
j_port = "editable[" + str(i) + "][j_port]"
|
||||
j_dept = "editable[" + str(i) + "][j_dept]"
|
||||
j_idc = "editable[" + str(i) + "][j_idc]"
|
||||
j_type = "editable[" + str(i) + "][j_type]"
|
||||
j_group = "editable[" + str(i) + "][j_group]"
|
||||
|
@ -145,11 +150,18 @@ def batch_host_edit(request):
|
|||
j_id = request.POST.get(j_id).strip()
|
||||
j_ip = request.POST.get(j_ip).strip()
|
||||
j_port = request.POST.get(j_port).strip()
|
||||
j_dept = request.POST.getlist(j_dept).strip()
|
||||
j_idc = request.POST.get(j_idc).strip()
|
||||
j_type = request.POST.get(j_type).strip()
|
||||
j_group = request.POST.getlist(j_group)
|
||||
j_active = request.POST.get(j_active).strip()
|
||||
j_comment = request.POST.get(j_comment).strip()
|
||||
print j_dept, j_group
|
||||
#
|
||||
# if is_group_admin(request) and not validate(request, asset=[j_id]):
|
||||
# emg = u'删除失败,您无权操作!'
|
||||
# print 'hehe'
|
||||
# return HttpResponseRedirect('/jasset/host_list/')
|
||||
|
||||
if j_type == 'M':
|
||||
j_user = "editable[" + str(i) + "][j_user]"
|
||||
|
@ -157,9 +169,9 @@ def batch_host_edit(request):
|
|||
j_user = request.POST.get(j_user).strip()
|
||||
password = request.POST.get(j_password).strip()
|
||||
j_password = cryptor.encrypt(password)
|
||||
jasset_host_edit(j_id, j_ip, j_idc, j_port, j_type, j_group, j_active, j_comment, j_user, j_password)
|
||||
jasset_host_edit(j_id, j_ip, j_idc, j_port, j_type, j_group, j_dept, j_active, j_comment, j_user, j_password)
|
||||
else:
|
||||
jasset_host_edit(j_id, j_ip, j_idc, j_port, j_type, j_group, j_active, j_comment)
|
||||
jasset_host_edit(j_id, j_ip, j_idc, j_port, j_type, j_group, j_dept, j_active, j_comment)
|
||||
|
||||
return render_to_response('jasset/host_list.html')
|
||||
|
||||
|
@ -187,7 +199,11 @@ def list_host(request):
|
|||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
|
||||
|
||||
elif is_common_user(request):
|
||||
pass
|
||||
user_id = request.session.get('user_id')
|
||||
username = User.objects.get(id=user_id).name
|
||||
posts = user_perm_asset_api(username)
|
||||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
|
||||
print posts, username
|
||||
return render_to_response('jasset/host_list.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
||||
|
@ -198,11 +214,18 @@ def host_del(request, offset):
|
|||
for i in range(int(len_list)):
|
||||
key = "id_list[" + str(i) + "]"
|
||||
jid = request.POST.get(key)
|
||||
print jid
|
||||
if is_group_admin(request) and not validate(request, asset=[jid]):
|
||||
emg = u'删除失败,您无权操作!'
|
||||
return HttpResponseRedirect('/jasset/host_list/')
|
||||
a = Asset.objects.get(id=jid).ip
|
||||
Asset.objects.filter(id=jid).delete()
|
||||
BisGroup.objects.filter(name=a).delete()
|
||||
else:
|
||||
jid = int(offset)
|
||||
if is_group_admin(request) and not validate(request, asset=[jid]):
|
||||
emg = u'删除失败,您无权操作!'
|
||||
return HttpResponseRedirect('/jasset/host_list/')
|
||||
a = Asset.objects.get(id=jid).ip
|
||||
BisGroup.objects.filter(name=a).delete()
|
||||
Asset.objects.filter(id=jid).delete()
|
||||
|
@ -234,8 +257,12 @@ def host_edit(request):
|
|||
j_active = request.POST.get('j_active')
|
||||
j_comment = request.POST.get('j_comment')
|
||||
j_idc = IDC.objects.get(name=j_idc)
|
||||
|
||||
if is_group_admin(request) and not validate(request, asset_group=j_group, edept=j_dept):
|
||||
emg = u'修改失败,您无权操作!'
|
||||
return render_to_response('jasset/host_edit.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
for group in j_group:
|
||||
print group
|
||||
c = BisGroup.objects.get(name=group)
|
||||
groups.append(c)
|
||||
|
||||
|
@ -373,8 +400,12 @@ def add_group(request):
|
|||
j_dept = request.POST.get('j_dept')
|
||||
j_hosts = request.POST.getlist('j_hosts')
|
||||
j_comment = request.POST.get('j_comment')
|
||||
j_dept = DEPT.objects.get(name=j_dept)
|
||||
|
||||
if is_group_admin(request) and not validate(request, asset=j_hosts, edept=[j_dept]):
|
||||
emg = u'添加失败,您无权操作!'
|
||||
return render_to_response('jasset/group_add.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
j_dept = DEPT.objects.get(name=j_dept)
|
||||
if BisGroup.objects.filter(name=j_group):
|
||||
emg = u'该主机组已存在!'
|
||||
return render_to_response('jasset/group_add.html', locals(), context_instance=RequestContext(request))
|
||||
|
@ -530,8 +561,4 @@ def host_search(request):
|
|||
comment__contains=keyword)).filter(dept=dept).distinct().order_by('ip')
|
||||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
|
||||
|
||||
return render_to_response('jasset/host_search.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def test(request):
|
||||
return render_to_response('jasset/test.html', locals())
|
||||
return render_to_response('jasset/host_search.html', locals(), context_instance=RequestContext(request))
|
|
@ -45,7 +45,12 @@ def log_list_online(request):
|
|||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
|
||||
|
||||
elif is_common_user(request):
|
||||
posts = Log.objects.filter(is_finished=0).filter(user=username).order_by('-start_time')
|
||||
if keyword:
|
||||
posts = Log.objects.filter(user=username).filter(Q(user__contains=keyword) | Q(host__contains=keyword))\
|
||||
.filter(is_finished=0).order_by('-start_time')
|
||||
else:
|
||||
posts = Log.objects.filter(is_finished=0).filter(user=username).order_by('-start_time')
|
||||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
|
||||
|
||||
return render_to_response('jlog/log_online.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
@ -75,8 +80,12 @@ def log_list_offline(request):
|
|||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
|
||||
|
||||
elif is_common_user(request):
|
||||
posts = Log.objects.filter(is_finished=1).filter(user=username).order_by('-start_time')
|
||||
|
||||
if keyword:
|
||||
posts = Log.objects.filter(user=username).filter(Q(user__contains=keyword) | Q(host__contains=keyword))\
|
||||
.filter(is_finished=1).order_by('-start_time')
|
||||
else:
|
||||
posts = Log.objects.filter(is_finished=1).filter(user=username).order_by('-start_time')
|
||||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
|
||||
return render_to_response('jlog/log_offline.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
||||
|
@ -105,6 +114,8 @@ def log_search(request):
|
|||
env = request.GET.get('env')
|
||||
dept_id = get_user_dept(request)
|
||||
dept_name = DEPT.objects.get(id=dept_id).name
|
||||
user_id = request.session.get('user_id')
|
||||
username = User.objects.get(id=user_id).username
|
||||
if is_super_user(request):
|
||||
if env == 'online':
|
||||
posts = contact_list = Log.objects.filter(Q(user__contains=keyword) | Q(host__contains=keyword)) \
|
||||
|
@ -122,4 +133,13 @@ def log_search(request):
|
|||
posts = contact_list = Log.objects.filter(Q(user__contains=keyword) | Q(host__contains=keyword)) \
|
||||
.filter(is_finished=1).filter(dept_name=dept_name).order_by('-start_time')
|
||||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
|
||||
|
||||
elif is_common_user(request):
|
||||
if env == 'online':
|
||||
posts = contact_list = Log.objects.filter(Q(user__contains=keyword) | Q(host__contains=keyword)) \
|
||||
.filter(is_finished=0).filter(user=username).order_by('-start_time')
|
||||
elif env == 'offline':
|
||||
posts = contact_list = Log.objects.filter(Q(user__contains=keyword) | Q(host__contains=keyword)) \
|
||||
.filter(is_finished=1).filter(user=username).order_by('-start_time')
|
||||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
|
||||
return render_to_response('jlog/log_search.html', locals(), context_instance=RequestContext(request))
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
import datetime
|
||||
|
||||
from uuidfield import UUIDField
|
||||
|
||||
from django.db import models
|
||||
from juser.models import UserGroup, DEPT
|
||||
from jasset.models import Asset, BisGroup
|
||||
|
@ -29,4 +33,20 @@ class SudoPerm(models.Model):
|
|||
comment = models.CharField(max_length=30, null=True, blank=True)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.user_group.name
|
||||
return self.user_group.name return self.name
|
||||
|
||||
|
||||
class Apply(models.Model):
|
||||
uuid = UUIDField(auto=True)
|
||||
applyer = models.CharField(max_length=20)
|
||||
approver = models.CharField(max_length=20)
|
||||
dept = models.CharField(max_length=20)
|
||||
bisgroup = models.CharField(max_length=500)
|
||||
asset = models.CharField(max_length=500)
|
||||
comment = models.TextField(blank=True, null=True)
|
||||
status = models.IntegerField(max_length=2)
|
||||
date_add = models.DateTimeField(default=datetime.datetime.now(), null=True)
|
||||
date_end = models.DateTimeField(null=True)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.applyer
|
||||
|
|
|
@ -23,4 +23,7 @@ urlpatterns = patterns('jperm.views',
|
|||
(r'^cmd_list/$', 'cmd_list'),
|
||||
(r'^cmd_del/$', 'cmd_del'),
|
||||
(r'^cmd_edit/$', 'cmd_edit'),
|
||||
(r'^apply/$', 'perm_apply'),
|
||||
(r'^apply_show/(\w+)/$', 'perm_apply_log'),
|
||||
(r'^apply_exec/$', 'perm_apply_exec'),
|
||||
)
|
||||
|
|
116
jperm/views.py
116
jperm/views.py
|
@ -1,11 +1,18 @@
|
|||
# coding: utf-8
|
||||
|
||||
import sys
|
||||
reload(sys)
|
||||
sys.setdefaultencoding('utf8')
|
||||
import datetime
|
||||
|
||||
|
||||
from django.core.mail import send_mail
|
||||
from django.shortcuts import render_to_response
|
||||
from django.http import HttpResponseRedirect, HttpResponse
|
||||
from django.template import RequestContext
|
||||
from juser.models import User, UserGroup, DEPT
|
||||
from jasset.models import Asset, BisGroup
|
||||
from jperm.models import Perm, SudoPerm, CmdGroup
|
||||
from jperm.models import Perm, SudoPerm, CmdGroup, Apply
|
||||
from django.core.paginator import Paginator, EmptyPage, InvalidPage
|
||||
from django.db.models import Q
|
||||
from jumpserver.views import LDAP_ENABLE, ldap_conn, CONF, page_list_return, pages
|
||||
|
@ -617,3 +624,110 @@ def cmd_del(request):
|
|||
if cmd_group:
|
||||
cmd_group[0].delete()
|
||||
return HttpResponseRedirect('/jperm/cmd_list/')
|
||||
|
||||
|
||||
@require_login
|
||||
def perm_apply(request):
|
||||
header_title, path1, path2 = u'主机权限申请', u'权限管理', u'申请主机'
|
||||
user_id = request.session.get('user_id')
|
||||
username = User.objects.get(id=user_id).username
|
||||
dept_id = get_user_dept(request)
|
||||
deptname = DEPT.objects.get(id=dept_id).name
|
||||
dept = DEPT.objects.get(id=dept_id)
|
||||
posts = Asset.objects.filter(dept=dept)
|
||||
egroup = dept.bisgroup_set.all()
|
||||
dept_da = User.objects.filter(dept_id=dept_id, role='DA')
|
||||
|
||||
if request.method == 'POST':
|
||||
applyer = request.POST.get('applyer')
|
||||
dept = request.POST.get('dept')
|
||||
da = request.POST.get('da')
|
||||
group = request.POST.getlist('group')
|
||||
hosts = request.POST.getlist('hosts')
|
||||
comment = request.POST.get('comment')
|
||||
da = User.objects.get(id=da)
|
||||
mail_address = da.email
|
||||
mail_title = '%s - 权限申请' % username
|
||||
# print da.username, applyer, group, hosts, datetime.datetime.now(), comment, url
|
||||
group_lis = ', '.join(group)
|
||||
hosts_lis = ', '.join(hosts)
|
||||
time_now = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
Apply.objects.create(applyer=applyer, dept=dept, bisgroup=group, asset=hosts, status=0, comment=comment)
|
||||
uuid = Apply.objects.get(applyer=applyer, asset=hosts, comment=comment).uuid
|
||||
url = "http://127.0.0.1:8000/jperm/apply_exec/?uuid=%s" % uuid
|
||||
mail_msg = """
|
||||
Hi,%s:
|
||||
有新的权限申请, 详情如下:
|
||||
申请人: %s
|
||||
申请主机组: %s
|
||||
申请的主机: %s
|
||||
申请时间: %s
|
||||
申请说明: %s
|
||||
请及时审批, 审批完成后点击以下链接,告知各位。
|
||||
%s
|
||||
""" % (da.username, applyer, group_lis, hosts_lis, time_now, comment, url)
|
||||
|
||||
send_mail(mail_title, mail_msg, 'jkfunshion@fun.tv', [mail_address], fail_silently=False)
|
||||
smg = "提交成功,已发邮件通知部门管理员。"
|
||||
return render_to_response('jperm/perm_apply.html', locals(), context_instance=RequestContext(request))
|
||||
return render_to_response('jperm/perm_apply.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def perm_apply_exec(request):
|
||||
uuid = request.GET.get('uuid')
|
||||
p_apply = Apply.objects.filter(uuid=str(uuid))
|
||||
q_apply = Apply.objects.get(uuid=str(uuid))
|
||||
if p_apply:
|
||||
user = User.objects.get(username=q_apply.applyer)
|
||||
mail_address = user.email
|
||||
time_now = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
p_apply.update(status=1, date_end=time_now)
|
||||
mail_title = '%s - 权限审批完成' % q_apply.applyer
|
||||
mail_msg = """
|
||||
Hi,%s:
|
||||
您所申请的权限已由 %s 在 %s 审批完成, 请登录验证。
|
||||
""" % (q_apply.applyer, q_apply.approver, time_now)
|
||||
send_mail(mail_title, mail_msg, 'jkfunshion@fun.tv', [mail_address], fail_silently=False)
|
||||
return render_to_response('jperm/perm_apply_exec.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def get_apply_posts(request, status, username, dept_name, keyword=None):
|
||||
if is_super_user(request):
|
||||
if keyword:
|
||||
posts = Apply.objects.filter(Q(applyer__contains=keyword) | Q(approver__contains=keyword)) \
|
||||
.filter(status=status).order_by('-date_add')
|
||||
else:
|
||||
posts = Apply.objects.filter(status=status).order_by('-date_add')
|
||||
|
||||
elif is_group_admin(request):
|
||||
if keyword:
|
||||
posts = Apply.objects.filter(Q(applyer__contains=keyword) | Q(approver__contains=keyword)) \
|
||||
.filter(status=status).filter(dept=dept_name).order_by('-date_add')
|
||||
else:
|
||||
posts = Log.objects.filter(status=status).filter(dept=dept_name).order_by('-date_add')
|
||||
|
||||
elif is_common_user(request):
|
||||
if keyword:
|
||||
posts = Apply.objects.filter(applyer=username).filter(status=status).filter(Q(applyer__contains=keyword) |
|
||||
Q(asset__contains=keyword)).order_by('-date_add')
|
||||
else:
|
||||
posts = Apply.objects.filter(applyer=username).filter(status=status).order_by('-date_add')
|
||||
return posts
|
||||
|
||||
|
||||
def perm_apply_log(request, offset):
|
||||
header_title, path1, path2 = u'权限申请记录', u'权限管理', u'申请记录'
|
||||
keyword = request.GET.get('keyword')
|
||||
dept_id = get_user_dept(request)
|
||||
dept_name = DEPT.objects.get(id=dept_id).name
|
||||
user_id = request.session.get('user_id')
|
||||
username = User.objects.get(id=user_id).username
|
||||
if offset == 'online':
|
||||
posts = get_apply_posts(request, 0, username, dept_name, keyword)
|
||||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
|
||||
return render_to_response('jperm/perm_log_online.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
elif offset == 'offline':
|
||||
posts = get_apply_posts(request, 1, username, dept_name, keyword)
|
||||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
|
||||
return render_to_response('jperm/perm_log_offline.html', locals(), context_instance=RequestContext(request))
|
||||
|
|
|
@ -9,10 +9,10 @@ database = jumpserver
|
|||
|
||||
[ldap]
|
||||
ldap_enable = 1
|
||||
host_url = ldap://127.0.0.1:389
|
||||
base_dn = dc=jumpserver, dc=org
|
||||
root_dn = cn=admin,dc=jumpserver,dc=org
|
||||
root_pw = secret234
|
||||
host_url = ldap://192.168.8.230:389
|
||||
base_dn = dc=fengxing, dc=com
|
||||
root_dn = cn=admin,dc=fengxing,dc=com
|
||||
root_pw = 123456
|
||||
|
||||
[websocket]
|
||||
web_socket_host = 127.0.0.1:3000
|
||||
|
@ -20,3 +20,9 @@ web_socket_host = 127.0.0.1:3000
|
|||
[web]
|
||||
key = 88aaaf7ffe3c6c04
|
||||
|
||||
[mail]
|
||||
email_host = 'mail.funshion.com'
|
||||
email_port = '25'
|
||||
email_host_user = 'jkfunshion'
|
||||
email_host_password = 'jkmail%'
|
||||
email_use_tls = False
|
|
@ -299,8 +299,12 @@ def asset_perm_api(asset):
|
|||
return user_permed_list
|
||||
|
||||
|
||||
def validate(request, user_group=None, user=None, asset_group=None, asset=None):
|
||||
def validate(request, user_group=None, user=None, asset_group=None, asset=None, edept=None):
|
||||
dept = get_session_user_dept(request)[1]
|
||||
if edept:
|
||||
if dept.name != edept[0]:
|
||||
return False
|
||||
|
||||
if user_group:
|
||||
dept_user_groups = dept.usergroup_set.all()
|
||||
user_groups = []
|
||||
|
@ -321,19 +325,24 @@ 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_id in asset_group:
|
||||
asset_groups.extend(BisGroup.objects.filter(id=asset_group_id))
|
||||
for asset_group_name in dept_asset_groups:
|
||||
asset_groups.extend(asset_group_name.name)
|
||||
|
||||
if not set(asset_groups).issubset(set(dept_asset_groups)):
|
||||
if len(asset_groups) == 0:
|
||||
return False
|
||||
|
||||
if not set(asset_group).issubset(set(asset_groups)):
|
||||
return False
|
||||
|
||||
if asset:
|
||||
dept_assets = dept.asset_set.all()
|
||||
assets = []
|
||||
for asset_id in asset:
|
||||
assets.extend(asset_id)
|
||||
assets, eassets = [], []
|
||||
for asset_id in dept_assets:
|
||||
eassets.append(int(asset_id.id))
|
||||
for i in asset:
|
||||
assets.append(int(i))
|
||||
|
||||
if not set(assets).issubset(dept_assets):
|
||||
if not set(assets).issubset(eassets):
|
||||
return False
|
||||
|
||||
return True
|
|
@ -23,6 +23,13 @@ DB_USER = config.get('db', 'user')
|
|||
DB_PASSWORD = config.get('db', 'password')
|
||||
DB_DATABASE = config.get('db', 'database')
|
||||
|
||||
# mail config
|
||||
EMAIL_HOST = 'mail.funshion.com'
|
||||
EMAIL_PORT = '25'
|
||||
EMAIL_HOST_USER = 'jkfunshion'
|
||||
EMAIL_HOST_PASSWORD = 'jkmail%'
|
||||
EMAIL_USE_TLS = False
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
|
||||
|
||||
|
@ -121,3 +128,4 @@ USE_TZ = False
|
|||
|
||||
STATIC_URL = '/static/'
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# coding: utf-8
|
||||
|
||||
import re
|
||||
import ast
|
||||
import time
|
||||
|
||||
from django import template
|
||||
|
@ -158,6 +160,11 @@ def group_type_to_str(type_name):
|
|||
return group_types.get(type_name)
|
||||
|
||||
|
||||
@register.filter(name='ast_to_list')
|
||||
def ast_to_list(lis):
|
||||
return ast.literal_eval(lis)
|
||||
|
||||
|
||||
# @register.filter(name='perm_asset_count')
|
||||
# def perm_asset_count(user_id):
|
||||
# return len(perm_user_asset(user_id))
|
||||
|
|
|
@ -6,6 +6,7 @@ from django.db.models import Count
|
|||
from django.shortcuts import render_to_response
|
||||
from django.template import RequestContext
|
||||
from jasset.models import IDC
|
||||
from juser.models import DEPT
|
||||
from jumpserver.api import *
|
||||
|
||||
|
||||
|
@ -82,13 +83,18 @@ def jasset_group_add(name, comment, jtype):
|
|||
smg = u'业务组%s添加成功' % name
|
||||
|
||||
|
||||
def jasset_host_edit(j_id, j_ip, j_idc, j_port, j_type, j_group, j_active, j_comment, j_user='', j_password=''):
|
||||
groups = []
|
||||
def jasset_host_edit(j_id, j_ip, j_idc, j_port, j_type, j_group, j_dept, j_active, j_comment, j_user='', j_password=''):
|
||||
groups, depts = [], []
|
||||
is_active = {u'是': '1', u'否': '2'}
|
||||
login_types = {'LDAP': 'L', 'SSH_KEY': 'S', 'PASSWORD': 'P', 'MAP': 'M'}
|
||||
login_types = {'LDAP': 'L', 'MAP': 'M'}
|
||||
for group in j_group[0].split():
|
||||
c = BisGroup.objects.get(name=group.strip())
|
||||
groups.append(c)
|
||||
print j_dept
|
||||
for d in j_dept[0].split():
|
||||
p = DEPT.objects.get(name=d.strip())
|
||||
depts.append(p)
|
||||
|
||||
j_type = login_types[j_type]
|
||||
j_idc = IDC.objects.get(name=j_idc)
|
||||
a = Asset.objects.get(id=j_id)
|
||||
|
@ -110,6 +116,7 @@ def jasset_host_edit(j_id, j_ip, j_idc, j_port, j_type, j_group, j_active, j_com
|
|||
a.comment = j_comment
|
||||
a.save()
|
||||
a.bis_group = groups
|
||||
a.dept = depts
|
||||
a.save()
|
||||
|
||||
|
||||
|
|
|
@ -54,9 +54,9 @@
|
|||
</select>
|
||||
</div>
|
||||
<div class="col-sm-1">
|
||||
<div class="fc-button-group" style="margin-top: 50px;">
|
||||
<button type="button" class="fc-button fc-state-default" onclick="move('groups', 'groups_selected')"><span class="fc-icon fc-icon-right-single-arrow"></span></button>
|
||||
<button type="button" class="fc-button fc-state-default" onclick="move_left('groups_selected', 'groups')"><span class="fc-icon fc-icon-left-single-arrow"></span></button>
|
||||
<div class="btn-group" style="margin-top: 50px;">
|
||||
<button type="button" class="btn btn-xm btn-white" onclick="move('groups', 'groups_selected')"><i class="fa fa-chevron-right"></i></button>
|
||||
<button type="button" class="btn btn-xm btn-white" onclick="move_left('groups_selected', 'groups')"><i class="fa fa-chevron-left"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
{% endif %}
|
||||
<h4>按照文本框内主机信息格式填写, 多台主机回车换行</h4>
|
||||
<form id="assetMulti" method="post" class="form-horizontal">
|
||||
<div><textarea id="j_multi" name="j_multi" type="text" placeholder="192.168.1.1 22 LDAP 北京联通 [网站,数据库] 运维部 1 网站服务器" class="form-control" style="width:700px;height:500px">192.168.1.1 22 LDAP 北京联通 ['网站','数据库'] ['运维部','测试部'] 1 网站服务器</textarea></div>
|
||||
<div><textarea id="j_multi" name="j_multi" type="text" placeholder="192.168.1.1 22 LDAP 北京联通 [网站,数据库] 运维部 1 网站服务器" class="form-control" style="width:700px;height:500px">192.168.1.1 22 LDAP 北京联通 ['网站','数据库'] ['运维部'] 1 网站服务器</textarea></div>
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-4">
|
||||
|
|
|
@ -69,15 +69,17 @@
|
|||
<td class="text-center" name="j_port"> {{ post.port }} </td>
|
||||
<td class="text-center" name="j_type"> {{ login_types|get_item:post.login_type }} </td>
|
||||
<td class="text-center" name="j_idc"> {{ post.idc.name }} </td>
|
||||
<td class="text-center" name="j_group">{{ post.dept.all | group_str2 }}</td>
|
||||
<td class="text-center" name="j_dept">{{ post.dept.all | group_str2 }}</td>
|
||||
<td class="text-center" name="j_group">{{ post.bis_group.all | group_str2 }}</td>
|
||||
<td class="text-center" name="j_active"> {{ post.is_active|bool2str }} </td>
|
||||
<!--<td class="text-center"> {{ post.date_added|date:"Y-m-d H:i:s" }} </td>-->
|
||||
<td class="text-center" name="j_comment"> {{ post.comment }} </td>
|
||||
<td class="text-center" data-editable='false'>
|
||||
<a value="/jasset/{{ post.ip }}/" class="iframe btn btn-xs btn-primary">详情</a>
|
||||
<a href="/jasset/host_edit/?id={{ post.id }}" class="btn btn-xs btn-info">编辑</a>
|
||||
<a href="/jasset/host_del/{{ post.id }}" class="btn btn-xs btn-danger">删除</a>
|
||||
{% ifnotequal session_role_id 0 %}
|
||||
<a href="/jasset/host_edit/?id={{ post.id }}" class="btn btn-xs btn-info">编辑</a>
|
||||
<a href="/jasset/host_del/{{ post.id }}" class="btn btn-xs btn-danger">删除</a>
|
||||
{% endifnotequal %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -80,7 +80,9 @@
|
|||
<th class="text-center"> 所属部门 </th>
|
||||
<th class="text-center"> 登录主机 </th>
|
||||
<th class="text-center"> 来源IP </th>
|
||||
<th class="text-center"> 命令统计 </th>
|
||||
{% ifnotequal session_role_id 0 %}
|
||||
<th class="text-center"> 命令统计 </th>
|
||||
{% endifnotequal %}
|
||||
<th class="text-center"> 登录时间 </th>
|
||||
<th class="text-center"> 结束时间 </th>
|
||||
|
||||
|
@ -93,7 +95,9 @@
|
|||
<td class="text-center" id="dept"> {{ post.dept_name }} </td>
|
||||
<td class="text-center" id="ip"> {{ post.host }} </td>
|
||||
<td class="text-center" id="remote_ip"> {{ post.remote_ip }} </td>
|
||||
<td class="text-center"><a href="/jlog/history/?id={{ post.id }}" class="log_command"> 命令统计 </td>
|
||||
{% ifnotequal session_role_id 0 %}
|
||||
<td class="text-center"><a href="/jlog/history/?id={{ post.id }}" class="log_command"> 命令统计 </td>
|
||||
{% endifnotequal %}
|
||||
<td class="text-center" id="start_time"> {{ post.start_time|date:"Y-m-d H:i:s"}} </td>
|
||||
<td class="text-center" id="end_time"> {{ post.end_time|date:"Y-m-d H:i:s" }} </td>
|
||||
</tr>
|
||||
|
|
|
@ -80,8 +80,10 @@
|
|||
<th class="text-center"> 所属部门 </th>
|
||||
<th class="text-center"> 登录主机 </th>
|
||||
<th class="text-center"> 来源IP </th>
|
||||
<th class="text-center"> 实时监控 </th>
|
||||
<th class="text-center"> 阻断 </th>
|
||||
{% ifnotequal session_role_id 0 %}
|
||||
<th class="text-center"> 实时监控 </th>
|
||||
<th class="text-center"> 阻断 </th>
|
||||
{% endifnotequal %}
|
||||
<th class="text-center"> 登录时间 </th>
|
||||
|
||||
</tr>
|
||||
|
@ -93,8 +95,10 @@
|
|||
<td id="ip" class="text-center"> {{ post.dept_name }} </td>
|
||||
<td id="ip" class="text-center"> {{ post.host }} </td>
|
||||
<td id="ip" class="text-center"> {{ post.remote_ip }} </td>
|
||||
<td class="text-center"><a class="monitor" filename="{{ post.log_path }}"> 监控 </a></td>
|
||||
<td class="text-center"><input type="button" id="cut" class="btn btn-danger btn-xs" name="cut" value="阻断" onclick='cut("{{ post.pid }}")' /></td>
|
||||
{% ifnotequal session_role_id 0 %}
|
||||
<td class="text-center"><a class="monitor" filename="{{ post.log_path }}"> 监控 </a></td>
|
||||
<td class="text-center"><input type="button" id="cut" class="btn btn-danger btn-xs" name="cut" value="阻断" onclick='cut("{{ post.pid }}")' /></td>
|
||||
{% endifnotequal %}
|
||||
<td class="text-center"> {{ post.start_time|date:"Y-m-d H:i:s" }} </td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -0,0 +1,163 @@
|
|||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
{% include 'nav_cat_bar.html' %}
|
||||
<style>
|
||||
.bootstrap-dialog-body {
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
.bootstrap-dialog-message {
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
.modal-content {
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
.modal-dialog {
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
width: 800px;
|
||||
}
|
||||
.modal-body {
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
.modal-header {
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
.bootstrap-dialog-message {
|
||||
color: #00FF00;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="ibox float-e-margins">
|
||||
<div id="ibox-content" class="ibox-title">
|
||||
<h5> 用户{{ username }}日志详细信息列表 </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">
|
||||
<li><a href="#">未启用 1</a>
|
||||
</li>
|
||||
<li><a href="#">未启用 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ibox-content">
|
||||
<div class="panel-options">
|
||||
<ul class="nav nav-tabs">
|
||||
<li style="float: right">
|
||||
<form id="search_form" method="get" action="" class="pull-right mail-search">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control input-sm" id="search_input" name="keyword" placeholder="Search">
|
||||
<input type="text" style="display: none">
|
||||
<div class="input-group-btn">
|
||||
<button id='search_btn' type="button" class="btn btn-sm btn-primary" onclick="log_search()">
|
||||
Search
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="tab-content">
|
||||
<table class="table table-striped table-bordered table-hover ">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center"> 用户名 </th>
|
||||
<th class="text-center"> 所属部门 </th>
|
||||
<th class="text-center"> 登录主机 </th>
|
||||
<th class="text-center"> 来源IP </th>
|
||||
<!--<th class="text-center"> 命令统计 </th>-->
|
||||
<th class="text-center"> 登录时间 </th>
|
||||
<th class="text-center"> 结束时间 </th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for post in contacts.object_list %}
|
||||
<tr class="gradeX">
|
||||
<td class="text-center" id="username"> {{ post.user }} </td>
|
||||
<td class="text-center" id="dept"> {{ post.dept_name }} </td>
|
||||
<td class="text-center" id="ip"> {{ post.host }} </td>
|
||||
<td class="text-center" id="remote_ip"> {{ post.remote_ip }} </td>
|
||||
<!--<td class="text-center"><a href="/jlog/history/?id={{ post.id }}" class="log_command"> 命令统计 </td>-->
|
||||
<td class="text-center" id="start_time"> {{ post.start_time|date:"Y-m-d H:i:s"}} </td>
|
||||
<td class="text-center" id="end_time"> {{ post.end_time|date:"Y-m-d H:i:s" }} </td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
</div>
|
||||
{% include 'paginator.html' %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{#<script src="http://{{ web_socket_host }}/socket.io/socket.io.js"></script>#}
|
||||
<script>
|
||||
$('.log_command').on('click',function(){
|
||||
var url = $(this).attr('href');
|
||||
var username = $('#username')[0].innerText;
|
||||
var ip = $('#ip')[0].innerText;
|
||||
var start_time = $('#start_time')[0].innerText;
|
||||
var end_time = $('#end_time')[0].innerText;
|
||||
var div_username = ' 登录用户名: '+'<span class="text-info">'+username+'' + '</span>';
|
||||
var div_ip = ' 登录主机: '+'<span class="text-info">' + ip + '</span>';
|
||||
var div_time = ' 开始时间: ' + '<span class="text-info">'+start_time +'</span>' + ' 结束时间: ' +'<span class="text-info">' + end_time + '</span'
|
||||
var title = 'JumpServer命令统计 '+ div_username + div_ip + div_time
|
||||
$.ajax({url:url,success:function(data){
|
||||
BootstrapDialog.show({title: title, message:data});
|
||||
}});
|
||||
return false;
|
||||
})
|
||||
globalConfig = {
|
||||
SOCKET_HOST: "{{ web_socket_host }}"
|
||||
}
|
||||
|
||||
function cut(num){
|
||||
var g_url = "/jlog/log_kill/"+num;
|
||||
console.log(g_url);
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: g_url,
|
||||
success: window.open("/jlog/","_self")
|
||||
});
|
||||
}
|
||||
|
||||
function log_search(){
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/jlog/search/?env=offline",
|
||||
data: $("#search_form").serialize(),
|
||||
success: function (data) {
|
||||
$(".tab-content").html(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$("#search_input").keydown(function(e){
|
||||
if(e.keyCode==13){
|
||||
log_search()
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
|
@ -0,0 +1,135 @@
|
|||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
{% include 'nav_cat_bar.html' %}
|
||||
<!--<h3 class="text-center">项目发布申请</h3>-->
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="row">
|
||||
<div class="col-lg-10">
|
||||
<div id="add_asset" class="ibox float-e-margins">
|
||||
<div id="ibox-content" 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">
|
||||
<li><a href="#">未启用 1</a>
|
||||
</li>
|
||||
<li><a href="#">未启用 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ibox-content">
|
||||
{% if emg %}
|
||||
<div class="alert alert-warning text-center">{{ emg }}</div>
|
||||
{% endif %}
|
||||
{% if smg %}
|
||||
<div class="alert alert-success text-center">{{ smg }}</div>
|
||||
{% endif %}
|
||||
<form id="assetForm" method="post" class="form-horizontal">
|
||||
{% csrf_token %}
|
||||
<div class="form-group"><label class="col-sm-2 control-label"> 申请人 </label>
|
||||
<div class="col-sm-8"><input type="text" name="applyer" value="{{ username }}" class="form-control" readonly="readonly"></div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group"><label class="col-sm-2 control-label"> 所在部门 </label>
|
||||
<div class="col-sm-8"><input type="text" name="dept" value="{{ deptname }}" class="form-control" readonly="readonly"></div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group"><label class="col-sm-2 control-label"> 部门管理员 </label>
|
||||
<div class="radio">
|
||||
{% for da in dept_da %}
|
||||
<label><input type="radio" value="{{ da.id }}" id="da" name="da"> {{ da }}</label>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<label for="group" class="col-lg-2 control-label">主机组<span class="red-fonts">*</span></label>
|
||||
<div class="col-sm-8">
|
||||
<select id="group" name="group" class="form-control m-b" multiple size="10">
|
||||
{% for g in egroup %}
|
||||
<option type="checkbox" value="{{ g.name }}">{{ g.name }} {% if g.comment %} --- {{ g.comment }} {% endif %}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div>
|
||||
<label for="groups" class="col-lg-2 control-label">主机<span class="red-fonts">*</span></label>
|
||||
<div class="col-sm-3">
|
||||
<select multiple="multiple" id="id_domains_filter" name="domains_filter" style="display: none;">
|
||||
</select>
|
||||
<div class="input-group" style="padding-bottom: 5px">
|
||||
<input type="text" size="19" class="form-control input-sm" id="search_input" name="keyword" placeholder="过滤" oninput="search_domain(this.value)">
|
||||
</div>
|
||||
<select id="groups" size="12" class="form-control m-b" multiple>
|
||||
{% for post in posts %}
|
||||
<option value="{{ post.ip }}">{{ post.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-1">
|
||||
<div class="btn-group" style="margin-top: 50px;">
|
||||
<button type="button" class="btn btn-xm btn-white" onclick="move('groups', 'groups_selected')"><i class="fa fa-chevron-right"></i></button>
|
||||
<button type="button" class="btn btn-xm btn-white" onclick="move_left('groups_selected', 'groups')"><i class="fa fa-chevron-left"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<h4 style="padding-bottom: 5px">已选中主机</h4>
|
||||
<div>
|
||||
<select id="groups_selected" name="hosts" class="form-control m-b" size="12" multiple>
|
||||
{% for post in eposts %}
|
||||
<option value="{{ post.ip }}">{{ post.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group"><label class="col-sm-2 control-label"> 申请说明 </label>
|
||||
<div class="col-sm-8"><textarea type="text" placeholder="" name="comment" class="form-control" rows="5" cols="20"></textarea></div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-5">
|
||||
<button class="btn btn-primary" type="submit"> 提交 </button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function search_domain(text){
|
||||
console.log(text)
|
||||
$("#groups").children().each(function(){$(this).remove();});
|
||||
$("#id_domains_filter").children().each(function(){
|
||||
if ($(this).text().search(text) != -1) {
|
||||
console.log(text);
|
||||
$("#groups").append($(this).clone())
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
{% endblock content %}
|
|
@ -0,0 +1,40 @@
|
|||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
{% include 'nav_cat_bar.html' %}
|
||||
<!--<h3 class="text-center">项目发布申请</h3>-->
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="row">
|
||||
<div class="col-lg-10">
|
||||
<div id="add_asset" class="ibox float-e-margins">
|
||||
<div id="ibox-content" 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">
|
||||
<li><a href="#">未启用 1</a>
|
||||
</li>
|
||||
<li><a href="#">未启用 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ibox-content">
|
||||
<h3>授权完成, 已邮件通知申请人, 五秒钟后关闭页面</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
</script>
|
||||
{% endblock content %}
|
|
@ -0,0 +1,93 @@
|
|||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
{% include 'nav_cat_bar.html' %}
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="ibox float-e-margins">
|
||||
<div id="ibox-content" 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">
|
||||
<li><a href="#">未启用 1</a>
|
||||
</li>
|
||||
<li><a href="#">未启用 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ibox-content">
|
||||
<div class="panel-options">
|
||||
<ul class="nav nav-tabs">
|
||||
<li><a href="/jperm/apply/online/" class="text-center"><i class="fa fa-laptop"></i> 未审批 </a></li>
|
||||
<li class="active"><a href="/jperm/apply/offline/" class="text-center"><i class="fa fa-bar-chart-o"></i> 已审批 </a></li>
|
||||
<li style="float: right">
|
||||
<form id="search_form" method="get" action="" class="pull-right mail-search">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control input-sm" id="search_input" name="keyword" placeholder="Search">
|
||||
<input type="text" style="display: none">
|
||||
<div class="input-group-btn">
|
||||
<button id='search_btn' type="button" class="btn btn-sm btn-primary" onclick="log_search()">
|
||||
Search
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="tab-content">
|
||||
<table class="table table-striped table-bordered table-hover ">
|
||||
<thead>
|
||||
<tr>
|
||||
<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>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for post in contacts.object_list %}
|
||||
<tr class="gradeX">
|
||||
<td class="text-center" id="username"> {{ post.applyer }} </td>
|
||||
<td class="text-center" id="dept"> {{ post.dept }} </td>
|
||||
<td class="text-center" id="ip"> {{ post.bisgroup }} </td>
|
||||
<td class="text-center" id="remote_ip"> {{ post.asset }} </td>
|
||||
<!--{% ifnotequal session_role_id 0 %}-->
|
||||
<!--<td class="text-center"><a href="/jlog/history/?id={{ post.id }}" class="log_command"> 命令统计 </td>-->
|
||||
<!--{% endifnotequal %}-->
|
||||
<td class="text-center" id="start_time"> {{ post.date_add|date:"Y-m-d H:i:s"}} </td>
|
||||
<td class="text-center" id="end_time"> {{ post.date_end|date:"Y-m-d H:i:s" }} </td>
|
||||
<td class="text-center" id=""> {{ post.comment }} </td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
</div>
|
||||
{% include 'paginator.html' %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,96 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load mytags %}
|
||||
{% block content %}
|
||||
{% include 'nav_cat_bar.html' %}
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="ibox float-e-margins">
|
||||
<div id="ibox-content" 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">
|
||||
<li><a href="#">未启用 1</a>
|
||||
</li>
|
||||
<li><a href="#">未启用 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ibox-content">
|
||||
<div class="panel-options">
|
||||
<ul class="nav nav-tabs">
|
||||
<li><a href="/jperm/apply_show/online/" class="text-center"><i class="fa fa-laptop"></i> 未审批 </a></li>
|
||||
<li class="active"><a href="/jperm/apply_show/offline/" class="text-center"><i class="fa fa-bar-chart-o"></i> 已审批 </a></li>
|
||||
<li style="float: right">
|
||||
<form id="search_form" method="get" action="" class="pull-right mail-search">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control input-sm" id="search_input" name="keyword" placeholder="Search">
|
||||
<input type="text" style="display: none">
|
||||
<div class="input-group-btn">
|
||||
<button id='search_btn' type="button" class="btn btn-sm btn-primary" onclick="log_search()">
|
||||
Search
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="tab-content">
|
||||
<table class="table table-striped table-bordered table-hover ">
|
||||
<thead>
|
||||
<tr>
|
||||
<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>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for post in contacts.object_list %}
|
||||
<tr class="gradeX">
|
||||
<td class="text-center" id="username"> {{ post.applyer }} </td>
|
||||
<td class="text-center" id="dept"> {{ post.dept }} </td>
|
||||
<td class="text-center" id="ip"> {% for i in post.bisgroup|ast_to_list %} {{ i }} {% endfor %} </td>
|
||||
<td class="text-center" id="remote_ip">{% for i in post.asset|ast_to_list %} {{ i }} {% endfor %} </td>
|
||||
<td class="text-center" id="approver"> {{ post.approver }} </td>
|
||||
<!--{% ifnotequal session_role_id 0 %}-->
|
||||
<!--<td class="text-center"><a href="/jlog/history/?id={{ post.id }}" class="log_command"> 命令统计 </td>-->
|
||||
<!--{% endifnotequal %}-->
|
||||
<td class="text-center" id="start_time"> {{ post.date_add|date:"Y-m-d H:i:s"}} </td>
|
||||
<td class="text-center" id="end_time"> {{ post.date_end|date:"Y-m-d H:i:s" }} </td>
|
||||
<td class="text-center" id=""> {{ post.comment }} </td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
</div>
|
||||
{% include 'paginator.html' %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,93 @@
|
|||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
{% include 'nav_cat_bar.html' %}
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="ibox float-e-margins">
|
||||
<div id="ibox-content" 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">
|
||||
<li><a href="#">未启用 1</a>
|
||||
</li>
|
||||
<li><a href="#">未启用 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ibox-content">
|
||||
<div class="panel-options">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="/jperm/apply_show/online/" class="text-center"><i class="fa fa-laptop"></i> 未审批 </a></li>
|
||||
<li><a href="/jperm/apply_show/offline/" class="text-center"><i class="fa fa-bar-chart-o"></i> 已审批 </a></li>
|
||||
<li style="float: right">
|
||||
<form id="search_form" method="get" action="" class="pull-right mail-search">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control input-sm" id="search_input" name="keyword" placeholder="Search">
|
||||
<input type="text" style="display: none">
|
||||
<div class="input-group-btn">
|
||||
<button id='search_btn' type="button" class="btn btn-sm btn-primary" onclick="log_search()">
|
||||
Search
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="tab-content">
|
||||
<table class="table table-striped table-bordered table-hover ">
|
||||
<thead>
|
||||
<tr>
|
||||
<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>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for post in contacts.object_list %}
|
||||
<tr class="gradeX">
|
||||
<td class="text-center" id="username"> {{ post.applyer }} </td>
|
||||
<td class="text-center" id="dept"> {{ post.dept }} </td>
|
||||
<td class="text-center" id="ip"> {{ post.bisgroup }} </td>
|
||||
<td class="text-center" id="remote_ip"> {{ post.asset }} </td>
|
||||
<!--{% ifnotequal session_role_id 0 %}-->
|
||||
<!--<td class="text-center"><a href="/jlog/history/?id={{ post.id }}" class="log_command"> 命令统计 </td>-->
|
||||
<!--{% endifnotequal %}-->
|
||||
<td class="text-center" id="start_time"> {{ post.date_add|date:"Y-m-d H:i:s"}} </td>
|
||||
<td class="text-center" id="end_time"> {{ post.date_end|date:"Y-m-d H:i:s" }} </td>
|
||||
<td class="text-center" id=""> {{ post.comment }} </td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
</div>
|
||||
{% include 'paginator.html' %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
|
@ -137,14 +137,18 @@
|
|||
<li>
|
||||
<a href="/"><i class="fa fa-rebel"></i> <span class="nav-label">个人信息</span><span class="label label-info pull-right"></span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/"><i class="fa fa-cube"></i> <span class="nav-label">查看主机</span><span class="label label-info pull-right"></span></a>
|
||||
<li id="jasset">
|
||||
<a href="/jasset/host_list/"><i class="fa fa-cube"></i> <span class="nav-label">查看主机</span><span class="label label-info pull-right"></span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/"><i class="fa fa-cube"></i> <span class="nav-label">申请主机</span><span class="label label-info pull-right"></span></a>
|
||||
<li id="jperm">
|
||||
<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="apply"><a href="/jperm/apply/">申请主机</a></li>
|
||||
<li class="apply_show online"><a href="/jperm/apply_show/online/">申请记录</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/"><i class="fa fa-files-o"></i> <span class="nav-label">登录历史</span><span class="label label-info pull-right"></span></a>
|
||||
<li id="jlog">
|
||||
<a href="/jlog/log_list/online/"><i class="fa fa-files-o"></i> <span class="nav-label">登录历史</span><span class="label label-info pull-right"></span></a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
|
Loading…
Reference in New Issue