url modify

pull/26/head
ibuler 2015-12-12 19:30:39 +08:00
parent 6d5513c69e
commit f849ffef3e
49 changed files with 269 additions and 988 deletions

View File

@ -40,14 +40,14 @@ class AssetGroup(models.Model):
class IDC(models.Model): class IDC(models.Model):
name = models.CharField(max_length=32, verbose_name=u'机房名称') name = models.CharField(max_length=32, verbose_name=u'机房名称')
bandwidth = models.CharField(max_length=32, blank=True, null=True, verbose_name=u'机房带宽') bandwidth = models.CharField(max_length=32, blank=True, null=True, default='', verbose_name=u'机房带宽')
linkman = models.CharField(max_length=16, blank=True, null=True, verbose_name=u'联系人') linkman = models.CharField(max_length=16, blank=True, null=True, default='', verbose_name=u'联系人')
phone = models.CharField(max_length=32, blank=True, null=True, verbose_name=u'联系电话') phone = models.CharField(max_length=32, blank=True, null=True, default='', verbose_name=u'联系电话')
address = models.CharField(max_length=128, blank=True, null=True, verbose_name=u"机房地址") address = models.CharField(max_length=128, blank=True, null=True, default='', verbose_name=u"机房地址")
network = models.TextField(blank=True, null=True, verbose_name=u"IP地址段") network = models.TextField(blank=True, null=True, default='', verbose_name=u"IP地址段")
date_added = models.DateField(auto_now=True, null=True) date_added = models.DateField(auto_now=True, default='', null=True)
operator = models.CharField(max_length=32, blank=True, null=True, verbose_name=u"运营商") operator = models.CharField(max_length=32, blank=True, default='', null=True, verbose_name=u"运营商")
comment = models.CharField(max_length=128, blank=True, null=True, verbose_name=u"备注") comment = models.CharField(max_length=128, blank=True, default='', null=True, verbose_name=u"备注")
def __unicode__(self): def __unicode__(self):
return self.name return self.name

View File

@ -3,23 +3,22 @@ from django.conf.urls import patterns, include, url
from jasset.views import * from jasset.views import *
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^asset_add/$', asset_add), url(r'^asset/add/$', asset_add, name='asset_add'),
url(r"^asset_add_batch/$", asset_add_batch), url(r"^asset/add_batch/$", asset_add_batch, name='asset_add_batch'),
url(r'^group_del/$', group_del), url(r'^asset/list/$', asset_list, name='asset_list'),
url(r'^asset_list/$', asset_list), url(r'^asset/del/$', asset_del, name='asset_del'),
url(r'^asset_del/$', asset_del), url(r"^asset/detail/$", asset_detail, name='asset_detail'),
url(r"^asset_detail/$", asset_detail), url(r'^asset/edit/$', asset_edit, name='asset_edit'),
url(r'^asset_edit/$', asset_edit), url(r'^asset/edit_batch/$', asset_edit_batch, name='asset_edit_batch'),
url(r'^asset_update/$', asset_update), url(r'^asset/update/$', asset_update, name='asset_update'),
url(r'^asset_update_batch/$', asset_update_batch), url(r'^asset/update_batch/$', asset_update_batch, name='asset_update_batch'),
url(r'^group_add/$', group_add), url(r'^asset/upload/$', asset_upload, name='asset_upload'),
url(r'^group_list/$', group_list), url(r'^group/del/$', group_del, name='asset_group_del'),
url(r'^group_edit/$', group_edit), url(r'^group/add/$', group_add, name='asset_group_add'),
url(r'^group_list/$', group_list), url(r'^group/list/$', group_list, name='asset_group_list'),
url(r'^asset_edit_batch/$', asset_edit_batch), url(r'^group/edit/$', group_edit, name='asset_group_edit'),
url(r'^idc_add/$', idc_add), url(r'^idc/add/$', idc_add, name='idc_add'),
url(r'^idc_list/$', idc_list), url(r'^idc/list/$', idc_list, name='idc_list'),
url(r'^idc_edit/$', idc_edit), url(r'^idc/edit/$', idc_edit, name='idc_edit'),
url(r'^idc_del/$', idc_del), url(r'^idc/del/$', idc_del, name='idc_del'),
url(r'^upload/$', asset_upload),
) )

View File

@ -81,7 +81,7 @@ def group_edit(request):
db_update_group(id=group_id, name=name, comment=comment, asset_select=asset_select) db_update_group(id=group_id, name=name, comment=comment, asset_select=asset_select)
smg = u"主机组 %s 添加成功" % name smg = u"主机组 %s 添加成功" % name
return HttpResponseRedirect('/jasset/group_list') return HttpResponseRedirect(reverse('asset_group_list'))
return my_render('jasset/group_edit.html', locals(), request) return my_render('jasset/group_edit.html', locals(), request)
@ -246,7 +246,7 @@ def asset_edit(request):
else: else:
emg = u'主机 %s 修改失败' % ip emg = u'主机 %s 修改失败' % ip
return my_render('jasset/error.html', locals(), request) return my_render('jasset/error.html', locals(), request)
return HttpResponseRedirect('/jasset/asset_detail/?id=%s' % asset_id) return HttpResponseRedirect(reverse('asset_detail')+'?id=%s' % asset_id)
return my_render('jasset/asset_edit.html', locals(), request) return my_render('jasset/asset_edit.html', locals(), request)
@ -451,10 +451,10 @@ def asset_update(request):
asset = get_object(Asset, id=asset_id) asset = get_object(Asset, id=asset_id)
name = request.user.username name = request.user.username
if not asset: if not asset:
return HttpResponseRedirect('/jasset/asset_detail/?id=%s' % asset_id) return HttpResponseRedirect(reverse('asset_detail')+'?id=%s' % asset_id)
else: else:
asset_ansible_update([asset], name) asset_ansible_update([asset], name)
return HttpResponseRedirect('/jasset/asset_detail/?id=%s' % asset_id) return HttpResponseRedirect(reverse('asset_detail')+'/?id=%s' % asset_id)
@require_role('admin') @require_role('admin')
@ -494,7 +494,7 @@ def idc_add(request):
else: else:
idc_form.save() idc_form.save()
smg = u'IDC: %s添加成功' % idc_name smg = u'IDC: %s添加成功' % idc_name
return HttpResponseRedirect("/jasset/idc_list/") return HttpResponseRedirect(reverse('idc_list'))
else: else:
idc_form = IdcForm() idc_form = IdcForm()
return my_render('jasset/idc_add.html', locals(), request) return my_render('jasset/idc_add.html', locals(), request)
@ -528,7 +528,7 @@ def idc_edit(request):
idc_form = IdcForm(request.POST, instance=idc) idc_form = IdcForm(request.POST, instance=idc)
if idc_form.is_valid(): if idc_form.is_valid():
idc_form.save() idc_form.save()
return HttpResponseRedirect("/jasset/idc_list/") return HttpResponseRedirect(reverse('idc_list'))
else: else:
idc_form = IdcForm(instance=idc) idc_form = IdcForm(instance=idc)
return my_render('jasset/idc_edit.html', locals(), request) return my_render('jasset/idc_edit.html', locals(), request)
@ -545,7 +545,7 @@ def idc_del(request):
for idc_id in idc_id_list: for idc_id in idc_id_list:
IDC.objects.filter(id=idc_id).delete() IDC.objects.filter(id=idc_id).delete()
return HttpResponseRedirect('/jasset/idc_list/') return HttpResponseRedirect(reverse('idc_list'))
@require_role('admin') @require_role('admin')

View File

@ -3,11 +3,9 @@ from django.conf.urls import patterns, include, url
from jlog.views import * from jlog.views import *
urlpatterns = patterns('', urlpatterns = patterns('',
(r'^$', log_list), url(r'^list/(\w+)/$', log_list, name='log_list'),
(r'^log_list/(\w+)/$', log_list), url(r'^detail/(\w+)/$', log_detail, name='log_detail'),
(r'^log_detail/(\w+)/$', log_detail), url(r'^history/$', log_history, name='log_history'),
(r'^history/$', log_history), url(r'^log_kill/', log_kill, name='log_kill'),
(r'^log_kill/', log_kill), url(r'^record/$', log_record, name='log_record'),
(r'^record/$', log_record),
(r'^web_terminal/$', web_terminal),
) )

View File

@ -127,14 +127,6 @@ def log_record(request):
return HttpResponse('无日志记录!') return HttpResponse('无日志记录!')
@require_role('user')
def web_terminal(request):
asset_id = request.GET.get('id')
role_name = request.GET.get('role')
web_terminal_uri = 'ws://%s/terminal?id=%s&role=%s' % (WEB_SOCKET_HOST, asset_id, role_name)
return render_to_response('jlog/web_terminal.html', locals())
@require_role('admin') @require_role('admin')
def log_detail(request, offset): def log_detail(request, offset):
log_id = request.GET.get('id') log_id = request.GET.get('id')

View File

@ -2,21 +2,21 @@ from django.conf.urls import patterns, include, url
from jperm.views import * from jperm.views import *
urlpatterns = patterns('jperm.views', urlpatterns = patterns('jperm.views',
(r'^rule/$', perm_rule_list), url(r'^rule/$', perm_rule_list, name='rule_list'),
(r'^perm_rule_add/$', perm_rule_add), url(r'^perm_rule_add/$', perm_rule_add, name='rule_add'),
(r'^perm_rule_detail/$', perm_rule_detail), url(r'^perm_rule_detail/$', perm_rule_detail, name='rule_detail'),
(r'^perm_rule_edit/$', perm_rule_edit), url(r'^perm_rule_edit/$', perm_rule_edit, name='rule_edit'),
(r'^perm_rule_delete/$', perm_rule_delete), url(r'^perm_rule_delete/$', perm_rule_delete, name='rule_del'),
(r'^role/$', perm_role_list), url(r'^role/$', perm_role_list, name='role_list'),
(r'^role/perm_role_add/$', perm_role_add), url(r'^role/perm_role_add/$', perm_role_add, name='role_add'),
(r'^role/perm_role_delete/$', perm_role_delete), url(r'^role/perm_role_delete/$', perm_role_delete, name='role_del'),
(r'^role/perm_role_detail/$', perm_role_detail), url(r'^role/perm_role_detail/$', perm_role_detail, name='role_detail'),
(r'^role/perm_role_edit/$', perm_role_edit), url(r'^role/perm_role_edit/$', perm_role_edit, name='role_edit'),
(r'^role/push/$', perm_role_push), url(r'^role/push/$', perm_role_push, name='role_push'),
(r'^role/recycle/$', perm_role_recycle), url(r'^role/recycle/$', perm_role_recycle, name='role_recycle'),
(r'^role/get/$', perm_role_get), url(r'^role/get/$', perm_role_get, name='role_get'),
(r'^sudo/$', perm_sudo_list), url(r'^sudo/$', perm_sudo_list, name='sudo_list'),
(r'^sudo/perm_sudo_add/$', perm_sudo_add), url(r'^sudo/perm_sudo_add/$', perm_sudo_add, name='sudo_add'),
(r'^sudo/perm_sudo_delete/$', perm_sudo_delete), url(r'^sudo/perm_sudo_delete/$', perm_sudo_delete, name='sudo_del'),
(r'^sudo/perm_sudo_edit/$', perm_sudo_edit), url(r'^sudo/perm_sudo_edit/$', perm_sudo_edit, name='sudo_edit'),
) )

View File

@ -140,7 +140,7 @@ def perm_rule_add(request):
rule.save() rule.save()
msg = u"添加授权规则:%s" % rule.name msg = u"添加授权规则:%s" % rule.name
return HttpResponseRedirect('/jperm/rule/') return HttpResponseRedirect(reverse('rule_list'))
except ServerError, e: except ServerError, e:
error = e error = e
return my_render('jperm/perm_rule_add.html', locals(), request) return my_render('jperm/perm_rule_add.html', locals(), request)
@ -296,7 +296,7 @@ def perm_role_add(request):
role.save() role.save()
role.sudo = sudos_obj role.sudo = sudos_obj
msg = u"添加角色: %s" % name msg = u"添加角色: %s" % name
return HttpResponseRedirect('/jperm/role/') return HttpResponseRedirect(reverse('role_list'))
except ServerError, e: except ServerError, e:
error = e error = e
@ -414,7 +414,7 @@ def perm_role_edit(request):
role.save() role.save()
msg = u"更新系统角色: %s" % role.name msg = u"更新系统角色: %s" % role.name
return HttpResponseRedirect('/jperm/role/') return HttpResponseRedirect(reverse('role_list'))
except ServerError, e: except ServerError, e:
error = e error = e

View File

@ -25,6 +25,7 @@ from jumpserver.models import Setting
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response from django.shortcuts import render_to_response
from django.core.mail import send_mail from django.core.mail import send_mail
from django.core.urlresolvers import reverse
def set_log(level, filename='jumpserver.log'): def set_log(level, filename='jumpserver.log'):
@ -265,15 +266,15 @@ def require_role(role='user'):
def __deco(request, *args, **kwargs): def __deco(request, *args, **kwargs):
request.session['pre_url'] = request.path request.session['pre_url'] = request.path
if not request.user.is_authenticated(): if not request.user.is_authenticated():
return HttpResponseRedirect('/login/') return HttpResponseRedirect(reverse('login'))
if role == 'admin': if role == 'admin':
# if request.session.get('role_id', 0) < 1: # if request.session.get('role_id', 0) < 1:
if request.user.role == 'CU': if request.user.role == 'CU':
return HttpResponseRedirect('/') return HttpResponseRedirect(reverse('index'))
elif role == 'super': elif role == 'super':
# if request.session.get('role_id', 0) < 2: # if request.session.get('role_id', 0) < 2:
if request.user.role in ['CU', 'GA']: if request.user.role in ['CU', 'GA']:
return HttpResponseRedirect('/') return HttpResponseRedirect(reverse('index'))
return func(request, *args, **kwargs) return func(request, *args, **kwargs)
return __deco return __deco
@ -350,7 +351,7 @@ def view_splitter(request, su=None, adm=None):
elif is_role_request(request, 'admin'): elif is_role_request(request, 'admin'):
return adm(request) return adm(request)
else: else:
return HttpResponseRedirect('/login/') return HttpResponseRedirect(reverse('login'))
def validate(request, user_group=None, user=None, asset_group=None, asset=None, edept=None): def validate(request, user_group=None, user=None, asset_group=None, asset=None, edept=None):

View File

@ -1,19 +1,20 @@
from django.conf.urls import patterns, include, url from django.conf.urls import patterns, include, url
urlpatterns = patterns('', urlpatterns = patterns('jumpserver.views',
# Examples: # Examples:
(r'^$', 'jumpserver.views.index'), url(r'^$', 'index', name='index'),
(r'^api/user/$', 'jumpserver.api.api_user'), # url(r'^api/user/$', 'api_user'),
(r'^skin_config/$', 'jumpserver.views.skin_config'), url(r'^skin_config/$', 'skin_config', name='skin_config'),
(r'^login/$', 'jumpserver.views.Login'), url(r'^login/$', 'Login', name='login'),
(r'^logout/$', 'jumpserver.views.Logout'), url(r'^logout/$', 'Logout', name='logout'),
(r'^exec_cmd/$', 'jumpserver.views.exec_cmd'), url(r'^exec_cmd/$', 'exec_cmd', name='exec_cmd'),
(r'^file/upload/$', 'jumpserver.views.upload'), url(r'^file/upload/$', 'upload', name='file_upload'),
(r'^file/download/$', 'jumpserver.views.download'), url(r'^file/download/$', 'download', name='file_download'),
(r'^setting', 'jumpserver.views.setting'), url(r'^setting', 'setting', name='setting'),
(r'^juser/', include('juser.urls')), url(r'^terminal/$', 'web_terminal', name='terminal'),
(r'^jasset/', include('jasset.urls')), url(r'^juser/', include('juser.urls')),
(r'^jlog/', include('jlog.urls')), url(r'^jasset/', include('jasset.urls')),
(r'^jperm/', include('jperm.urls')), url(r'^jlog/', include('jlog.urls')),
url(r'^jperm/', include('jperm.urls')),
) )

View File

@ -79,7 +79,7 @@ def get_count_by_date(date_li, item):
@require_role(role='user') @require_role(role='user')
def index_cu(request): def index_cu(request):
username = request.user.username username = request.user.username
return HttpResponseRedirect('/juser/user_detail/') return HttpResponseRedirect(reverse('user_detail'))
@require_role(role='user') @require_role(role='user')
@ -169,7 +169,7 @@ def Login(request):
"""登录界面""" """登录界面"""
error = '' error = ''
if request.user.is_authenticated(): if request.user.is_authenticated():
return HttpResponseRedirect('/') return HttpResponseRedirect(reverse('index'))
if request.method == 'GET': if request.method == 'GET':
return render_to_response('login.html') return render_to_response('login.html')
else: else:
@ -211,7 +211,7 @@ def Login(request):
@require_role('user') @require_role('user')
def Logout(request): def Logout(request):
logout(request) logout(request)
return HttpResponseRedirect('/login/') return HttpResponseRedirect(reverse('index'))
@require_role('admin') @require_role('admin')
@ -343,3 +343,11 @@ def exec_cmd(request):
check_assets = request.GET.get('check_assets', '') check_assets = request.GET.get('check_assets', '')
web_terminal_uri = 'ws://%s/exec?role=%s' % (WEB_SOCKET_HOST, role) web_terminal_uri = 'ws://%s/exec?role=%s' % (WEB_SOCKET_HOST, role)
return my_render('exec_cmd.html', locals(), request) return my_render('exec_cmd.html', locals(), request)
@require_role('user')
def web_terminal(request):
asset_id = request.GET.get('id')
role_name = request.GET.get('role')
web_terminal_uri = 'ws://%s/terminal?id=%s&role=%s' % (WEB_SOCKET_HOST, asset_id, role_name)
return render_to_response('jlog/web_terminal.html', locals())

View File

@ -6,25 +6,20 @@ urlpatterns = patterns('juser.views',
# Examples: # Examples:
# url(r'^$', 'jumpserver.views.home', name='home'), # url(r'^$', 'jumpserver.views.home', name='home'),
# url(r'^blog/', include('blog.urls')), # url(r'^blog/', include('blog.urls')),
url(r'^group/add/$', 'group_add', name='user_group_add'),
(r'^group_add/$', group_add), url(r'^group/list/$', 'group_list', name='user_group_list'),
(r'^group_list/$', group_list), url(r'^group/del/$', 'group_del', name='user_group_del'),
(r'^group_del/$', group_del), url(r'^group/edit/$', 'group_edit', name='user_group_edit'),
(r'^group_edit/$', group_edit), url(r'^user/add/$', 'user_add', name='user_add'),
url(r'^user/del/$', 'user_del', name='user_del'),
(r'^user_add/$', user_add), url(r'^user/list/$', 'user_list', name='user_list'),
(r'^user_del/$', 'user_del'), url(r'^user/edit/$', 'user_edit', name='user_edit'),
(r'^user_list/$', user_list), url(r'^user/detail/$', 'user_detail', name='user_detail'),
(r'^user_edit/$', user_edit), url(r'^user/profile/$', 'profile', name='user_profile'),
(r'^user_detail/$', 'user_detail'), url(r'^user/update/$', 'change_info', name='user_update'),
url(r'^mail/retry/$', 'send_mail_retry', name='mail_retry'),
(r'^profile/$', 'profile'), url(r'^password/reset/$', 'reset_password', name='password_reset'),
url(r'^password/forget/$', 'forget_password', name='password_forget'),
(r'^send_mail_retry/$', send_mail_retry), url(r'^key/gen/$', 'regen_ssh_key', name='key_gen'),
(r'^reset_password/$', reset_password), url(r'^key/down/$', 'down_key', name='key_down'),
(r'^forget_password/$', forget_password),
(r'^change_info/$', 'change_info'),
(r'^regen_ssh_key/$', 'regen_ssh_key'),
(r'^down_key/$', 'down_key'),
) )

View File

@ -169,7 +169,7 @@ def user_add_mail(user, kwargs):
您的权限 %s 您的权限 %s
您的web登录密码 %s 您的web登录密码 %s
您的ssh密钥文件密码 %s 您的ssh密钥文件密码 %s
密钥下载地址 %s/juser/down_key/?uuid=%s 密钥下载地址 %s/juser/key/down/?uuid=%s
说明 请登陆后再下载密钥 说明 请登陆后再下载密钥
""" % (user.name, user.username, user_role.get(user.role, u'普通用户'), """ % (user.name, user.username, user_role.get(user.role, u'普通用户'),
kwargs.get('password'), kwargs.get('ssh_key_pwd'), URL, user.uuid) kwargs.get('password'), kwargs.get('ssh_key_pwd'), URL, user.uuid)
@ -195,7 +195,7 @@ def get_display_msg(user, password, ssh_key_pwd, ssh_key_login_need, send_mail_n
用户名%s 用户名%s
密码%s 密码%s
密钥密码%s 密钥密码%s
密钥下载url: %s/juser/down_key/?uuid=%s 密钥下载url: %s/juser/key/down/?uuid=%s
该账号密码可以登陆web和跳板机 该账号密码可以登陆web和跳板机
""" % (URL, user.username, password, ssh_key_pwd, URL, user.uuid) """ % (URL, user.username, password, ssh_key_pwd, URL, user.uuid)
else: else:

View File

@ -124,7 +124,7 @@ def group_edit(request):
except ServerError, e: except ServerError, e:
error = e error = e
if not error: if not error:
return HttpResponseRedirect('/juser/group_list/') return HttpResponseRedirect(reverse('user_group_list'))
else: else:
users_all = User.objects.all() users_all = User.objects.all()
users_selected = User.objects.filter(group=user_group) users_selected = User.objects.filter(group=user_group)
@ -229,7 +229,7 @@ def user_detail(request):
user = get_object(User, id=user_id) user = get_object(User, id=user_id)
if not user: if not user:
return HttpResponseRedirect('/juser/user_list/') return HttpResponseRedirect(reverse('user_list'))
user_perm_info = get_group_user_perm(user) user_perm_info = get_group_user_perm(user)
role_assets = user_perm_info.get('role') role_assets = user_perm_info.get('role')
@ -339,7 +339,7 @@ def user_edit(request):
if request.method == 'GET': if request.method == 'GET':
user_id = request.GET.get('id', '') user_id = request.GET.get('id', '')
if not user_id: if not user_id:
return HttpResponseRedirect('/') return HttpResponseRedirect(reverse('index'))
user_role = {'SU': u'超级管理员', 'CU': u'普通用户'} user_role = {'SU': u'超级管理员', 'CU': u'普通用户'}
user = get_object(User, id=user_id) user = get_object(User, id=user_id)
@ -364,7 +364,7 @@ def user_edit(request):
if user_id: if user_id:
user = get_object(User, id=user_id) user = get_object(User, id=user_id)
else: else:
return HttpResponseRedirect('/juser/user_list/') return HttpResponseRedirect(reverse('user_list'))
if password != '': if password != '':
password_decode = password password_decode = password
@ -392,7 +392,7 @@ def user_edit(request):
""" % (user.name, URL, user.username, password_decode, user_role.get(role_post, u'')) """ % (user.name, URL, user.username, password_decode, user_role.get(role_post, u''))
send_mail('您的信息已修改', msg, MAIL_FROM, [email], fail_silently=False) send_mail('您的信息已修改', msg, MAIL_FROM, [email], fail_silently=False)
return HttpResponseRedirect('/juser/user_list/') return HttpResponseRedirect(reverse('user_list'))
return my_render('juser/user_edit.html', locals(), request) return my_render('juser/user_edit.html', locals(), request)
@ -400,7 +400,7 @@ def user_edit(request):
def profile(request): def profile(request):
user_id = request.user.id user_id = request.user.id
if not user_id: if not user_id:
return HttpResponseRedirect('/') return HttpResponseRedirect(reverse('index'))
user = User.objects.get(id=user_id) user = User.objects.get(id=user_id)
return my_render('juser/profile.html', locals(), request) return my_render('juser/profile.html', locals(), request)
@ -411,7 +411,7 @@ def change_info(request):
user = User.objects.get(id=user_id) user = User.objects.get(id=user_id)
error = '' error = ''
if not user: if not user:
return HttpResponseRedirect('/') return HttpResponseRedirect(reverse('index'))
if request.method == 'POST': if request.method == 'POST':
name = request.POST.get('name', '') name = request.POST.get('name', '')

View File

@ -270,8 +270,11 @@ class ExecHandler(tornado.websocket.WebSocketHandler):
def run_cmd(self, command, pattern): def run_cmd(self, command, pattern):
self.runner.run('shell', command, pattern=pattern) self.runner.run('shell', command, pattern=pattern)
newline_pattern = re.compile(r'\n')
for k, v in self.runner.results.items(): for k, v in self.runner.results.items():
for host, output in v.items(): for host, output in v.items():
output = newline_pattern.sub('<br />', output)
logger.debug(output)
if k == 'ok': if k == 'ok':
header = "<span style='color: green'>[ %s => %s]</span>\n" % (host, 'Ok') header = "<span style='color: green'>[ %s => %s]</span>\n" % (host, 'Ok')
else: else:

View File

@ -15,7 +15,7 @@
<div id="footer"> <div id="footer">
<div class="content"> <div class="content">
<input type="text" id="pattern" value="{{ check_assets }}" placeholder="Ansible Pattern"> <input type="text" id="pattern" value="{{ check_assets }}" placeholder="Ansible Pattern">
<input type="text" id="command" placeholder="Command to execute"> <input type="text" id="command" placeholder="Command to execute" onkeypress="if(event.keyCode==13){sendMessage()}">
<input type="button" id="send_btn" value="Send" onclick="sendMessage()"> <input type="button" id="send_btn" value="Send" onclick="sendMessage()">
</div> </div>
</div> </div>
@ -92,7 +92,7 @@
{# background-color: #ecf0f1;#} {# background-color: #ecf0f1;#}
{# border: #000 solid 5px;#} {# border: #000 solid 5px;#}
background: #000; background: #000;
width: 800px; width: 720px;
box-shadow: rgba(0, 0, 0, 0.8) 2px 2px 20px; box-shadow: rgba(0, 0, 0, 0.8) 2px 2px 20px;
color: #fff; color: #fff;
} }
@ -109,7 +109,7 @@
position: fixed; position: fixed;
bottom: 0; bottom: 0;
height: 50px; height: 50px;
width: 800px; width: 720px;
{# border: #000 solid -10px;#} {# border: #000 solid -10px;#}
background-color: #2980b9; background-color: #2980b9;
} }
@ -130,7 +130,7 @@
} }
.content { .content {
width: 800px; width: 720px;
margin-left: 5px; margin-left: 5px;
} }
@ -169,11 +169,11 @@
} }
@media(max-width: 1000px) { @media(max-width: 1000px) {
.content { width: 90%; } .content { width: 100%; }
} }
@media(max-width: 780px) { @media(max-width: 780px) {
#footer { height: 91px; } #footer { height: 51px; }
#chat_box { padding-bottom: 91px; } #chat_box { padding-bottom: 91px; }
#user { width: 100%; } #user { width: 100%; }
@ -192,6 +192,7 @@
} }
} }
</style> </style>
</body> </body>
<div></div> <div></div>
<div></div> <div></div>

View File

@ -28,14 +28,13 @@
<script src="/static/js/dropzone/dropzone.js"></script> <script src="/static/js/dropzone/dropzone.js"></script>
<!-- active menu --> <!-- active menu -->
<script> <script>
var str = document.location.pathname.split("/")[1]; var url_array = document.location.pathname.split("/");
var str1 = document.location.pathname.split("/")[2]; s1 = url_array[1];
$("#"+str).addClass('active'); s2 = url_array[2];
if($("."+str1).length>0) { if (s1 == ''){
$("."+str1).addClass('active'); $('#index').addClass('active')
} } else {
$("#"+s1).addClass('active');
if(str.length==0){ $('#'+s1+' .'+s2).addClass('active');
$("#index").addClass('active');
} }
</script> </script>

View File

@ -13,7 +13,7 @@
<h5>用户总数</h5> <h5>用户总数</h5>
</div> </div>
<div class="ibox-content"> <div class="ibox-content">
<h1 class="no-margins"><a href="/juser/user_list/">{{ users.count}}</a></h1> <h1 class="no-margins"><a href="{% url 'user_list' %}">{{ users.count}}</a></h1>
<small>All user</small> <small>All user</small>
</div> </div>
</div> </div>
@ -25,7 +25,7 @@
<h5>主机总数</h5> <h5>主机总数</h5>
</div> </div>
<div class="ibox-content"> <div class="ibox-content">
<h1 class="no-margins"><a href="/jasset/host_list/">{{ hosts.count }}</a></h1> <h1 class="no-margins"><a href="{% url 'asset_list' %}">{{ hosts.count }}</a></h1>
<small>All host</small> <small>All host</small>
</div> </div>
</div> </div>
@ -38,7 +38,7 @@
<h5>在线用户</h5> <h5>在线用户</h5>
</div> </div>
<div class="ibox-content"> <div class="ibox-content">
<h1 class="no-margins"><a href="/jlog/log_list/online/"> <span id="online_users">{{ online_user | length }}</span></a></h1> <h1 class="no-margins"><a href="{% url 'log_list' 'online' %}"> <span id="online_users">{{ online_user | length }}</span></a></h1>
{# <div class="stat-percent font-bold text-navy">{{ percent_online_user }} <i class="fa fa-level-up"></i></div>#} {# <div class="stat-percent font-bold text-navy">{{ percent_online_user }} <i class="fa fa-level-up"></i></div>#}
<small>Online user</small> <small>Online user</small>
</div> </div>
@ -52,7 +52,7 @@
<h5>已连接服务器</h5> <h5>已连接服务器</h5>
</div> </div>
<div class="ibox-content"> <div class="ibox-content">
<h1 class="no-margins"><a href="/jlog/log_list/online/"> <span id="online_hosts">{{ online_host | length }}</span></a></h1> <h1 class="no-margins"><a href="{% url 'log_list' 'online' %}"> <span id="online_hosts">{{ online_host | length }}</span></a></h1>
<small>Connected host</small> <small>Connected host</small>
</div> </div>
</div> </div>

View File

@ -25,7 +25,7 @@
<div class="ibox-content" style="line-height: 26px"> <div class="ibox-content" style="line-height: 26px">
<span style="font-size: large"></span>迎使用<span class="text-navy"><b>Jumpserver</b></span>跳板机系统, <span style="font-size: large"></span>迎使用<span class="text-navy"><b>Jumpserver</b></span>跳板机系统,
首先需要 <b><a href="/juser/down_key/?id={{ user.id }}">下载</a></b> 登录跳板机的SSH密钥文件然后导入到工具或者ssh命令指定密钥文件(确保密钥文件权限600),输入收到的密钥密码,登录跳板机。 首先需要 <b><a href="{% url 'key_down' %}?id={{ user.id }}">下载</a></b> 登录跳板机的SSH密钥文件然后导入到工具或者ssh命令指定密钥文件(确保密钥文件权限600),输入收到的密钥密码,登录跳板机。
登录后根据提示进行操作。跳板机web界面支持修改密码、个人信息和上传下载文件等功能可以向管理员申请权限。 登录后根据提示进行操作。跳板机web界面支持修改密码、个人信息和上传下载文件等功能可以向管理员申请权限。
</div> </div>
</div> </div>

View File

@ -26,8 +26,8 @@
<div class="panel blank-panel"> <div class="panel blank-panel">
<div class="panel-options"> <div class="panel-options">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li class="active"><a href="/jasset/asset_add/" class="text-center"><i class="fa fa-laptop"></i> 单台添加 </a></li> <li class="active"><a href="{% url 'asset_add' %}" class="text-center"><i class="fa fa-laptop"></i> 单台添加 </a></li>
<li><a href="/jasset/asset_add_batch" class="text-center"><i class="fa fa-bar-chart-o"></i> 批量添加 </a></li> <li><a href="{% url 'asset_add_batch' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 批量添加 </a></li>
</ul> </ul>
</div> </div>
<div class="panel-body"> <div class="panel-body">

View File

@ -31,8 +31,8 @@
<div class="panel blank-panel"> <div class="panel blank-panel">
<div class="panel-options"> <div class="panel-options">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li><a href="/jasset/asset_add/" class="text-center"><i class="fa fa-laptop"></i> 单台添加 </a></li> <li><a href="{% url 'asset_add' %}" class="text-center"><i class="fa fa-laptop"></i> 单台添加 </a></li>
<li class="active"><a href="/jasset/asset_add_batch/" class="text-center"><i class="fa fa-bar-chart-o"></i> 批量添加 </a></li> <li class="active"><a href="{% url 'asset_add_batch' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 批量添加 </a></li>
</ul> </ul>
</div> </div>
<div class="panel-body"> <div class="panel-body">

View File

@ -29,10 +29,10 @@
<input type="text" class="form-control m-b input-sm" id="search_input" name="keyword" value="{{ keyword }}" placeholder="Search"> <input type="text" class="form-control m-b input-sm" id="search_input" name="keyword" value="{{ keyword }}" placeholder="Search">
<input type="text" style="display: none"> <input type="text" style="display: none">
<div class="input-group-btn"> <div class="input-group-btn">
<button id='search_btn' href="/jasset/asset_list/?search=true" type="button" class="btn btn-sm btn-primary search-btn" onclick="change_info()"> <button id='search_btn' href="{% url 'asset_list' %}?search=true" type="button" class="btn btn-sm btn-primary search-btn" onclick="change_info()">
- 搜索 - - 搜索 -
</button> </button>
<button type="button" href="/jasset/asset_list/?export=true" name="export" class="btn btn-sm btn-success search-btn-excel" onclick="return false"> <button type="button" href="{% url 'asset_list' %}?export=true" name="export" class="btn btn-sm btn-success search-btn-excel" onclick="return false">
- 导出 - - 导出 -
</button> </button>
</div> </div>
@ -63,7 +63,7 @@
<td class="text-center" name="id" value="{{ asset.id }}" data-editable='false'> <td class="text-center" name="id" value="{{ asset.id }}" data-editable='false'>
<input name="id" value="{{ asset.id }}" type="checkbox" class="i-checks"> <input name="id" value="{{ asset.id }}" type="checkbox" class="i-checks">
</td> </td>
<td class="text-center hostname"> <a href="/jasset/asset_detail/?id={{ asset.id }}">{{ asset.hostname|default_if_none:"" }}</a></td> <td class="text-center hostname"> <a href="{% url 'asset_detail' %}?id={{ asset.id }}">{{ asset.hostname|default_if_none:"" }}</a></td>
<td class="text-center"> {{ asset.ip|default_if_none:"" }} </td> <td class="text-center"> {{ asset.ip|default_if_none:"" }} </td>
<td class="text-center"> {{ asset.idc.name|default_if_none:"" }} </td> <td class="text-center"> {{ asset.idc.name|default_if_none:"" }} </td>
<td class="text-center">{{ asset.group.all|group_str2 }}</td> <td class="text-center">{{ asset.group.all|group_str2 }}</td>

View File

@ -11,7 +11,7 @@
<div class="ibox-title"> <div class="ibox-title">
<span class="text text-primary"><b>{{ asset.ip }}</b></span> <span class="text text-primary"><b>{{ asset.ip }}</b></span>
<div class="ibox-tools"> <div class="ibox-tools">
<a class="" href="/jasset/asset_update/?id={{ asset.id }}"> <a class="" href="{% url 'asset_update' %}?id={{ asset.id }}">
<i class="fa fa-refresh"></i> <i class="fa fa-refresh"></i>
</a> </a>
<a class="collapse-link"> <a class="collapse-link">
@ -200,13 +200,13 @@
<td class="text-navy">系统角色</td> <td class="text-navy">系统角色</td>
{% for perm in user_perm %} {% for perm in user_perm %}
<tr> <tr>
<td class="text-navy"><a href="/juser/user_detail/?id={{ perm.0.id }}">{{ perm.0 }}</a></td> <td class="text-navy"><a href="{% url 'user_detail' %}?id={{ perm.0.id }}">{{ perm.0 }}</a></td>
<td> <td>
<table class="table"> <table class="table">
{% if perm.1 %} {% if perm.1 %}
{% for role in perm.1 %} {% for role in perm.1 %}
<tr> <tr>
<td class="text-navy"><a href="/jperm/role/perm_role_detail/?id={{ role.id }}">{{ role }}</a></td> <td class="text-navy"><a href="{% url 'role_detail' %}?id={{ role.id }}">{{ role }}</a></td>
</tr> </tr>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
@ -224,7 +224,7 @@
{% for user_group in user_group_perm %} {% for user_group in user_group_perm %}
<tr> <tr>
<td class="text-navy">{{ user_group }}</td> <td class="text-navy">{{ user_group }}</td>
<td class="text-navy"><a href="/juser/user_list/?gid={{ user_group.id }}">详情</a></td> <td class="text-navy"><a href="{% url 'user_group_list' %}?gid={{ user_group.id }}">详情</a></td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
@ -238,7 +238,7 @@
{% for rule in user_rule_perm %} {% for rule in user_rule_perm %}
<tr> <tr>
<td class="text-navy">{{ rule }}</td> <td class="text-navy">{{ rule }}</td>
<td class="text-navy"><a href="/jperm/perm_rule_detail/?id={{ rule.id }}">详情</a></td> <td class="text-navy"><a href="{% url 'rule_detail' %}/?id={{ rule.id }}">详情</a></td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
@ -251,7 +251,7 @@
</div> </div>
<div class="ibox-title"> <div class="ibox-title">
<h5>主机修改记录</h5> <h5>主机修改记录</h5>
<a href="/jasset/asset_edit/?id={{ asset.id }}" data-toggle="tooltip" class="text-success pull-center" data-placement="bottom" title="修改">&nbsp&nbsp&nbsp&nbsp点击修改</a> <a href="{% url 'asset_edit' %}?id={{ asset.id }}" data-toggle="tooltip" class="text-success pull-center" data-placement="bottom" title="修改">&nbsp&nbsp&nbsp&nbsp点击修改</a>
<div class="ibox-tools"> <div class="ibox-tools">
<a class="collapse-link"> <a class="collapse-link">
<i class="fa fa-chevron-up"></i> <i class="fa fa-chevron-up"></i>

View File

@ -25,7 +25,7 @@
<div class="ibox-content"> <div class="ibox-content">
<form id="asset_form"> <form id="asset_form">
<div class="col-sm-1" style="padding-left: 0"> <div class="col-sm-1" style="padding-left: 0">
<a href="/jasset/asset_add/" class="btn btn-sm btn-primary "> 添加资产 </a> <a href="{% url 'asset_add' %}" class="btn btn-sm btn-primary "> 添加资产 </a>
</div> </div>
<div class="col-sm-7" style="padding-left: 0px"> <div class="col-sm-7" style="padding-left: 0px">
@ -87,10 +87,10 @@
<input type="text" class="form-control m-b input-sm" id="search_input" name="keyword" value="{{ keyword }}" placeholder="Search"> <input type="text" class="form-control m-b input-sm" id="search_input" name="keyword" value="{{ keyword }}" placeholder="Search">
<input type="text" style="display: none"> <input type="text" style="display: none">
<div class="input-group-btn"> <div class="input-group-btn">
<button id='search_btn' href="/jasset/asset_list/?search=true" type="button" class="btn btn-sm btn-primary search-btn" onclick="change_info()"> <button id='search_btn' href="{% url 'asset_list' %}?search=true" type="button" class="btn btn-sm btn-primary search-btn" onclick="change_info()">
- 搜索 - - 搜索 -
</button> </button>
<button type="button" href="/jasset/asset_list/?export=true" name="export" class="btn btn-sm btn-success search-btn-excel" onclick="return false"> <button type="button" href="{% url 'asset_list' %}?export=true" name="export" class="btn btn-sm btn-success search-btn-excel" onclick="return false">
- 导出 - - 导出 -
</button> </button>
</div> </div>
@ -121,7 +121,7 @@
<td class="text-center" name="id" value="{{ asset.id }}" data-editable='false'> <td class="text-center" name="id" value="{{ asset.id }}" data-editable='false'>
<input name="id" value="{{ asset.id }}" type="checkbox" class="i-checks"> <input name="id" value="{{ asset.id }}" type="checkbox" class="i-checks">
</td> </td>
<td class="text-center hostname"> <a href="/jasset/asset_detail/?id={{ asset.id }}">{{ asset.hostname|default_if_none:"" }}</a></td> <td class="text-center hostname"> <a href="{% url 'asset_detail' %}?id={{ asset.id }}">{{ asset.hostname|default_if_none:"" }}</a></td>
<td class="text-center"> {{ asset.ip|default_if_none:"" }} </td> <td class="text-center"> {{ asset.ip|default_if_none:"" }} </td>
<td class="text-center"> {{ asset.idc.name|default_if_none:"" }} </td> <td class="text-center"> {{ asset.idc.name|default_if_none:"" }} </td>
<td class="text-center">{{ asset.group.all|group_str2 }}</td> <td class="text-center">{{ asset.group.all|group_str2 }}</td>
@ -131,9 +131,9 @@
<td class="text-center"> {{ asset.memory|default_if_none:"" }}{% if asset.memory %}G{% endif %}</td> <td class="text-center"> {{ asset.memory|default_if_none:"" }}{% if asset.memory %}G{% endif %}</td>
<td class="text-center"> {{ asset.disk|get_disk_info }}{% if asset.memory %}G{% endif %}</td> <td class="text-center"> {{ asset.disk|get_disk_info }}{% if asset.memory %}G{% endif %}</td>
<td class="text-center" data-editable='false'> <td class="text-center" data-editable='false'>
<a href="/jasset/asset_edit/?id={{ asset.id }}" class="btn btn-xs btn-info">编辑</a> <a href="{% url 'asset_edit' %}?id={{ asset.id }}" class="btn btn-xs btn-info">编辑</a>
<a value="{{ asset.id }}" class="conn btn btn-xs btn-warning">连接</a> <a value="{{ asset.id }}" class="conn btn btn-xs btn-warning">连接</a>
<a value="/jasset/asset_del/?id={{ asset.id }}" class="btn btn-xs btn-danger asset_del">删除</a> <a value="{% url 'asset_del' %}?id={{ asset.id }}" class="btn btn-xs btn-danger asset_del">删除</a>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
@ -142,7 +142,7 @@
<div class="row"> <div class="row">
<div class="col-sm-6"> <div class="col-sm-6">
<input type="button" id="asset_del" class="btn btn-danger btn-sm" name="del_button" value="删除"/> <input type="button" id="asset_del" class="btn btn-danger btn-sm" name="del_button" value="删除"/>
<a value="/jasset/asset_edit_batch/" type="button" class="btn btn-sm btn-warning iframe">修改</a> <a value="{% url 'asset_edit_batch' %}" type="button" class="btn btn-sm btn-warning iframe">修改</a>
<input type="button" id="asset_update" class="btn btn-info btn-sm" name="update_button" value="更新"/> <input type="button" id="asset_update" class="btn btn-info btn-sm" name="update_button" value="更新"/>
{# <input type="button" id="asset_update_all" class="btn btn-primary btn-sm" name="update_button" value="更新全部"/>#} {# <input type="button" id="asset_update_all" class="btn btn-primary btn-sm" name="update_button" value="更新全部"/>#}
<input type="button" id="exec_cmd" class="btn btn-sm btn-primary" name="exec_cmd" value="执行命令"/> <input type="button" id="exec_cmd" class="btn btn-sm btn-primary" name="exec_cmd" value="执行命令"/>
@ -174,8 +174,8 @@
}); });
$('#exec_cmd').click(function(){ $('#exec_cmd').click(function(){
var url = '/jperm/role/get/'; var url = '{% url "role_get" %}';
var new_url = '/exec_cmd/?role='; var new_url = '{% url "exec_cmd" %}?role=';
var check_array = []; var check_array = [];
$(".gradeX input:checked").closest('tr').find('.hostname a').each(function() { $(".gradeX input:checked").closest('tr').find('.hostname a').each(function() {
check_array.push($(this).text()) check_array.push($(this).text())
@ -194,7 +194,7 @@
title: title, title: title,
maxmin: true, maxmin: true,
shade: false, shade: false,
area: ['800px', '600px'], area: ['725px', '600px'],
content: new_url+data+'&check_assets='+check_assets content: new_url+data+'&check_assets='+check_assets
}); });
//window.open(new_url + data, '', 'location=no, resizeable=no, height=410, width=625, top=89px, left=99px,toolbar=no,menubar=no,scrollbars=auto,status=no'); //window.open(new_url + data, '', 'location=no, resizeable=no, height=410, width=625, top=89px, left=99px,toolbar=no,menubar=no,scrollbars=auto,status=no');
@ -219,9 +219,9 @@
}); });
$('.conn').click(function(){ $('.conn').click(function(){
var url='/jperm/role/get/?id=' + $(this).attr('value'); // 获取用户有权限的角色 var url='{% url "role_get" %}?id=' + $(this).attr('value'); // 获取用户有权限的角色
var href = $(this).attr('href'); var href = $(this).attr('href');
var new_url = '/jlog/web_terminal/?id=' + $(this).attr('value') + '&role='; // webterminal socket url var new_url = '{% url "terminal" %}?id=' + $(this).attr('value') + '&role='; // webterminal socket url
var hostname = $(this).closest('tr').find('.hostname a')[0].innerHTML; var hostname = $(this).closest('tr').find('.hostname a')[0].innerHTML;
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
@ -338,7 +338,7 @@
$.ajax({ $.ajax({
type: "post", type: "post",
data: {asset_id_all: asset_id_all}, data: {asset_id_all: asset_id_all},
url: "/jasset/asset_del/?arg=batch", url: "{% url 'asset_del' %}?arg=batch",
success: function () { success: function () {
parent.location.reload(); parent.location.reload();
} }
@ -353,7 +353,7 @@
layer.msg('玩命更新中...', {time: 200000}); layer.msg('玩命更新中...', {time: 200000});
$.ajax({ $.ajax({
type: "post", type: "post",
url: "/jasset/asset_update_batch/?arg=all", url: "{% url 'asset_update_batch' %}?arg=all",
success: function () { success: function () {
parent.location.reload(); parent.location.reload();
} }
@ -365,7 +365,7 @@
$.ajax({ $.ajax({
type: "post", type: "post",
data: {asset_id_all: asset_id_all}, data: {asset_id_all: asset_id_all},
url: "/jasset/asset_update_batch/", url: "{% url 'asset_add_batch' %}",
success: function () { success: function () {
parent.location.reload(); parent.location.reload();
} }
@ -386,7 +386,7 @@
function change_info(){ function change_info(){
var args = $("#asset_form").serialize(); var args = $("#asset_form").serialize();
window.location = "/jasset/asset_list/?" + args window.location = "{% url 'asset_list' %}?" + args
} }
$("#search_input").keydown(function(e){ $("#search_input").keydown(function(e){

View File

@ -23,7 +23,7 @@
</div> </div>
<div class="ibox-content"> <div class="ibox-content">
<div class=""> <div class="">
<a href="/jasset/group_add/" class="btn btn-sm btn-primary "> 添加主机组 </a> <a href="{% url 'asset_group_add' %}" class="btn btn-sm btn-primary "> 添加主机组 </a>
<a class="btn btn-sm btn-danger" id="del_check"> 删除所选 </a> <a class="btn btn-sm btn-danger" id="del_check"> 删除所选 </a>
<form id="search_form" method="get" action="" class="pull-right mail-search"> <form id="search_form" method="get" action="" class="pull-right mail-search">
<div class="input-group"> <div class="input-group">
@ -58,12 +58,12 @@
<input name="id" value="{{ asset_group.id }}" type="checkbox" class="i-checks"> <input name="id" value="{{ asset_group.id }}" type="checkbox" class="i-checks">
</td> </td>
<td class="text-center"> {{ asset_group.name }} </td> <td class="text-center"> {{ asset_group.name }} </td>
<td class="text-center"> <a href="/jasset/asset_list/?group_id={{ asset_group.id }}">{{ asset_group.asset_set.count }}</a> </td> <td class="text-center"> <a href="{% url 'asset_list' %}?group_id={{ asset_group.id }}">{{ asset_group.asset_set.count }}</a> </td>
<td class="text-center"> {{ asset_group.comment }} </td> <td class="text-center"> {{ asset_group.comment }} </td>
<td class="text-center"> <td class="text-center">
<a href="/jasset/asset_list/?group_id={{ asset_group.id }}" class="btn btn-xs btn-info">详情</a> <a href="{% url 'asset_list' %}?group_id={{ asset_group.id }}" class="btn btn-xs btn-info">详情</a>
<a href="/jasset/group_edit/?id={{ asset_group.id }}" class="btn btn-xs btn-info">编辑</a> <a href="{% url 'asset_list' %}?id={{ asset_group.id }}" class="btn btn-xs btn-info">编辑</a>
<a value="/jasset/group_del/?id={{ asset_group.id }}" class="btn btn-xs btn-danger group_del">删除</a> <a value="{% url 'asset_group_del' %}?id={{ asset_group.id }}" class="btn btn-xs btn-danger group_del">删除</a>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
@ -108,7 +108,7 @@
check_array.push($(this).attr('value')) check_array.push($(this).attr('value'))
}); });
$.get( $.get(
'/jasset/group_del/', '{% url "asset_group_del" %}',
{id: check_array.join(',')}, {id: check_array.join(',')},
function(data){ function(data){
$('tr.gradeX input:checked').closest('tr').remove(); $('tr.gradeX input:checked').closest('tr').remove();

View File

@ -17,10 +17,6 @@
<i class="fa fa-wrench"></i> <i class="fa fa-wrench"></i>
</a> </a>
<ul class="dropdown-menu dropdown-user"> <ul class="dropdown-menu dropdown-user">
<li><a href="#">未启用 1</a>
</li>
<li><a href="#">未启用 2</a>
</li>
</ul> </ul>
<a class="close-link"> <a class="close-link">
<i class="fa fa-times"></i> <i class="fa fa-times"></i>
@ -29,7 +25,7 @@
</div> </div>
<div class="ibox-content"> <div class="ibox-content">
<div class=""> <div class="">
<a href="/jasset/idc_add" class="btn btn-sm btn-primary "> 添加机房 </a> <a href="{% url 'idc_add' %}" class="btn btn-sm btn-primary "> 添加机房 </a>
<input type="button" id="del_check" class="btn btn-danger btn-sm" name="del_button" value="删除所选"/> <input type="button" id="del_check" class="btn btn-danger btn-sm" name="del_button" value="删除所选"/>
<form id="search_form" method="get" action="" class="pull-right mail-search"> <form id="search_form" method="get" action="" class="pull-right mail-search">
<div class="input-group"> <div class="input-group">
@ -64,14 +60,14 @@
<tr class="gradeX"> <tr class="gradeX">
<td class="text-center" name="j_id" value="{{ post.id }}" data-editable='false'><input name="id" value="{{ post.id }}" type="checkbox" class="i-checks"></td> <td class="text-center" name="j_id" value="{{ post.id }}" data-editable='false'><input name="id" value="{{ post.id }}" type="checkbox" class="i-checks"></td>
<td class="text-center"> {{ post.name }} </td> <td class="text-center"> {{ post.name }} </td>
<td class="text-center"> <a href="/jasset/asset_list/?idc_id={{ post.id }}">{{ post.asset_set.count }}</a> </td> <td class="text-center"> <a href="{% url 'asset_list' %}?idc_id={{ post.id }}">{{ post.asset_set.count }}</a> </td>
<td class="text-center"> {{ post.linkman }} </td> <td class="text-center"> {{ post.linkman }} </td>
<td class="text-center"> {{ post.phone }} </td> <td class="text-center"> {{ post.phone }} </td>
<td class="text-center"> {{ post.comment }} </td> <td class="text-center"> {{ post.comment }} </td>
<td class="text-center"> <td class="text-center">
<a href="/jasset/asset_list/?idc_id={{ post.id }}" class="iframe btn btn-xs btn-primary">详情</a> <a href="{% url 'asset_list' %}?idc_id={{ post.id }}" class="iframe btn btn-xs btn-primary">详情</a>
<a href="/jasset/idc_edit/?id={{ post.id }}" class="btn btn-xs btn-info">编辑</a> <a href="{% url 'idc_edit' %}?id={{ post.id }}" class="btn btn-xs btn-info">编辑</a>
<a href="/jasset/idc_del/?id={{ post.id }}" class="btn btn-xs btn-danger idc_del">删除</a> <a href="{% url 'idc_del' %}?id={{ post.id }}" class="btn btn-xs btn-danger idc_del">删除</a>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
@ -91,7 +87,9 @@
</div> </div>
</div> </div>
</div> </div>
{% endblock %}
{% block self_footer_js %}
<script> <script>
$(document).ready(function(){ $(document).ready(function(){
$('.idc_del').click(function(){ $('.idc_del').click(function(){
@ -103,7 +101,8 @@
function (data) { function (data) {
row.remove(); row.remove();
} }
) );
return false
} }
}); });
@ -114,16 +113,15 @@
check_array.push($(this).attr('value')) check_array.push($(this).attr('value'))
}); });
$.get( $.get(
'/jasset/idc_del/', '{% url "idc_del" %}',
{id: check_array.join(',')}, {id: check_array.join(',')},
function(data){ function(data){
$('tr.gradeX input:checked').closest('tr').remove(); $('tr.gradeX input:checked').closest('tr').remove();
} }
) );
return false;
} }
}) })
}); });
</script> </script>
{% endblock %} {% endblock %}

View File

@ -1,106 +0,0 @@
{% load mytags %}
<html>
<head>
{% include 'link_css.html' %}
{% include 'head_script.html' %}
<style type="text/css">
body
{
background: #FFFFFF;
}
</style>
</head>
<body>
<div class="row">
<div class="contact-box">
<h3 class="text-center">{{ offset }}主机详情</h3>
<table class="table table-striped table-bordered table-hover " id="editable" >
<thead>
<tr>
<th> IP地址 </th>
<th> 端口号 </th>
<th> 登录方式 </th>
<th> 所属IDC </th>
<th> 所属业务组 </th>
<th> 添加时间 </th>
<th> 备注 </th>
</tr>
</thead>
<tbody>
<tr class="gradeX">
<td> <a id="ip" class="iframe" href="/jasset/{{ post.ip }}/">{{ post.ip }}</a></td>
<td> {{ post.port }} </td>
<td> {{ post.login_type|get_login_type }} </td>
<td class="text-center"> {{ post.idc.name }} </td>
<td class="text-center">{% for group in post.bis_group.all %} {{ group }} {% endfor %}</td>
<td class="text-center"> {{ post.date_added|date:"Y-m-d H:i:s" }} </td>
<td class="text-center"> {{ post.comment }} </td>
</tr>
</tbody>
</table>
<h3 class="text-center">{{ offset }}主机用户权限详情</h3>
<table class="table table-striped table-bordered table-hover " id="editable" >
<thead>
<tr>
<th> 用户名 </th>
</tr>
</thead>
<tbody>
<tr class="gradeX">
<td>
{% for user in user_permed_list %}
<a class="btn"> {{ user.name }} </a>
{% endfor %}
</td>
</tr>
</tbody>
</table>
<!--<a> 是否 激活: {{ post.is_active }}</a>-->
<h3 class="text-center">最近一周登录详情</h3>
<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>
</tr>
</thead>
<tbody>
{% for l in log %}
<tr class="gradeX">
<td class="text-center" id="username"> {{ l.user }} </td>
<td class="text-center" id="start_time">{{ l.start_time|date:"Y-m-d H:i:s" }}</td>
<td class="text-center" id="end_time"> {{ l.end_time|date:"Y-m-d H:i:s" }} </td>
<td class="text-center">
<a class="log_command text-success" href="/jlog/history/?id={{ l.id }}">命令统计</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</body>
<script src="/static/js/bootstrap-dialog.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 = div_username + div_ip + div_time
$.ajax({url:url,success:function(data){
BootstrapDialog.show({title: title, message:data});
}});
return false;
})
</script>
</html>

View File

@ -29,10 +29,10 @@
<div class="ibox-content"> <div class="ibox-content">
<div class="panel-options"> <div class="panel-options">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li><a href="/jlog/log_list/online/" class="text-center"><i class="fa fa-laptop"></i> 在线 </a></li> <li><a href="{% url 'log_list' 'online' %}" class="text-center"><i class="fa fa-laptop"></i> 在线 </a></li>
<li><a href="/jlog/log_list/offline/" class="text-center"><i class="fa fa-bar-chart-o"></i> 历史记录 </a></li> <li><a href="{% url 'log_list' 'offline' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 历史记录 </a></li>
<li class="active"><a href="/jlog/log_list/exec/" class="text-center"><i class="fa fa-bar-chart-o"></i> 命令记录 </a></li> <li class="active"><a href="{% url 'log_list' 'exec' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 命令记录 </a></li>
<li><a href="/jlog/log_list/file/" class="text-center"><i class="fa fa-bar-chart-o"></i> 上传下载 </a></li> <li><a href="{% url 'log_list' 'file' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 上传下载 </a></li>
<div class="" style="float: right"> <div class="" style="float: right">
<form id="search_form" method="get" action="" class="pull-right mail-search"> <form id="search_form" method="get" action="" class="pull-right mail-search">
<div class="input-group"> <div class="input-group">
@ -72,7 +72,7 @@
<td class="text-center remote_ip"> {{ post.remote_ip }} </td> <td class="text-center remote_ip"> {{ post.remote_ip }} </td>
<td class="text-center start_time"> {{ post.datetime|date:"Y-m-d H:i:s"}} </td> <td class="text-center start_time"> {{ post.datetime|date:"Y-m-d H:i:s"}} </td>
<td class="text-center"> <td class="text-center">
<a href="/jlog/log_detail/exec/?id={{ post.id }}" class="btn btn-xs btn-primary">详情</a> <a href="{% url 'log_detail' 'exec' %}?id={{ post.id }}" class="btn btn-xs btn-primary">详情</a>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View File

@ -29,10 +29,10 @@
<div class="ibox-content"> <div class="ibox-content">
<div class="panel-options"> <div class="panel-options">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li><a href="/jlog/log_list/online/" class="text-center"><i class="fa fa-laptop"></i> 在线 </a></li> <li><a href="{% url 'log_list' 'online' %}" class="text-center"><i class="fa fa-laptop"></i> 在线 </a></li>
<li><a href="/jlog/log_list/offline/" class="text-center"><i class="fa fa-bar-chart-o"></i> 历史记录 </a></li> <li><a href="{% url 'log_list' 'offline' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 历史记录 </a></li>
<li><a href="/jlog/log_list/exec/" class="text-center"><i class="fa fa-bar-chart-o"></i> 命令记录 </a></li> <li><a href="{% url 'log_list' 'exec' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 命令记录 </a></li>
<li class="active"><a href="/jlog/log_list/file/" class="text-center"><i class="fa fa-bar-chart-o"></i> 上传下载 </a></li> <li class="active"><a href="{% url 'log_list' 'file' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 上传下载 </a></li>
<div class="" style="float: right"> <div class="" style="float: right">
<form id="search_form" method="get" action="" class="pull-right mail-search"> <form id="search_form" method="get" action="" class="pull-right mail-search">
<div class="input-group"> <div class="input-group">
@ -74,7 +74,7 @@
<td class="text-center"> {{ post.remote_ip }} </td> <td class="text-center"> {{ post.remote_ip }} </td>
<td class="text-center"> {{ post.datetime|date:"Y-m-d H:i:s"}} </td> <td class="text-center"> {{ post.datetime|date:"Y-m-d H:i:s"}} </td>
<td class="text-center"> <td class="text-center">
<a href="/jlog/log_detail/file/?id={{ post.id }}" class="btn btn-xs btn-primary">详情</a> <a href="{% url 'log_detail' 'file' %}?id={{ post.id }}" class="btn btn-xs btn-primary">详情</a>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View File

@ -1,139 +0,0 @@
{% extends 'base.html' %}
{% block self_head_css_js %}
<link href="/static/css/plugins/datepicker/datepicker3.css" rel="stylesheet">
<link href="/static/css/plugins/chosen/chosen.css" rel="stylesheet">
<script src="/static/js/plugins/chosen/chosen.jquery.js"></script>
{% endblock %}
{% block content %}
{% include 'nav_cat_bar.html' %}
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-sm-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>
<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="/jlog/log_list/online/" class="text-center"><i class="fa fa-laptop"></i> 在线 </a></li>
<li><a href="/jlog/log_list/offline/" class="text-center"><i class="fa fa-bar-chart-o"></i> 历史记录 </a></li>
<li class="active"><a href="/jlog/search/" class="text-center"><i class="fa fa-bar-chart-o"></i> 详细搜索 </a></li>
</ul>
</div>
<br/>
<div class="tab-content">
<form method="get" action="" role="form" class="form-inline">
<p>
选择相应条件进行搜索
</p>
<div class="form-group" id="data_5">
<div class="input-daterange input-group" id="datepicker">
<input type="text" class="input-sm form-control" style="width: 100px;" name="start" value="{{ date_seven_day }}">
<span class="input-group-addon">to</span>
<input type="text" class="input-sm form-control" style="width: 100px;" name="end" value="{{ date_now_str }}">
</div>
</div>
<div class="form-group">
<div class="input-group">
<select name="single" data-placeholder="用户名" class="chosen-select" multiple style="width:300px;" tabindex="2">
<option value="用户">用户名</option>
<option value="Bolivia, Plurinational State of">hongweiguang</option>
<option value="Bonaire, Sint Eustatius and Saba">wangyong</option>
<option value="Bosnia and Herzegovina">hehe</option>
<option value="Botswana">wangyong</option>
<option value="Bouvet Island">wangyongd</option>
<option value="Romania">Romania</option>
<option value="Zambia">Zambia</option>
<option value="Zimbabwe">Zimbabwe</option>
</select>
</div>
</div>
<div class="form-group">
<div class="input-group">
<select name="multi" data-placeholder="主机" class="chosen-select" multiple style="width:200px;" tabindex="4">
<option value="主机">主机</option>
<option value="United States">172.16.1.1</option>
<option value="Afghanistan">172.16.1.1</option>
<option value="Aland Islands">172.16.1.1</option>
<option value="Albania">172.16.1.1</option>
<option value="Algeria">172.16.1.1</option>
<option value="American Samoa">172.16.1.1</option>
<option value="Andorra">172.16.1.1</option>
<option value="Angola">172.16.1.1</option>
<option value="Anguilla">172.16.1.1</option>
<option value="Antarctica">172.16.1.1</option>
</select>
</div>
</div>
<div class="form-group">
<input id="cmd" name="cmd" placeholder="命令" type="text" class="form-control" style="width: 200px;">
</div>
<div class="form-group">
<button id="submit_button" class="btn btn-primary" type="submit">搜索</button>
</div>
</form>
<div class="row">
<div class="col-sm-6">
</div>
{% include 'paginator.html' %}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
function log_search(){
$.ajax({
type: "GET",
url: "/jlog/search/?env=offline",
data: $("#search_form").serialize(),
success: function (data) {
$(".tab-content").html(data);
}
});
}
$(document).ready(function(){
$('#data_5 .input-daterange').datepicker({
dateFormat: 'yy-mm-dd',
keyboardNavigation: false,
forceParse: false,
autoclose: true
});
});
var config = {
'.chosen-select' : {},
'.chosen-select-deselect' : {allow_single_deselect:true},
'.chosen-select-no-single' : {disable_search_threshold:10},
'.chosen-select-no-results': {no_results_text:'Oops, nothing found!'},
'.chosen-select-width' : {width:"95%"}
};
for (var selector in config) {
$(selector).chosen(config[selector]);
}
</script>
{% endblock %}
{% block self_footer_js %}
<script src="/static/js/cropper/cropper.min.js"></script>
<script src="/static/js/datapicker/bootstrap-datepicker.js"></script>
<script src="/static/js/plugins/chosen/chosen.jquery.js"></script>
{% endblock %}

View File

@ -52,10 +52,10 @@
<div class="ibox-content"> <div class="ibox-content">
<div class="panel-options"> <div class="panel-options">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li><a href="/jlog/log_list/online/" class="text-center"><i class="fa fa-laptop"></i> 在线 </a></li> <li><a href="{% url 'log_list' 'online' %}" class="text-center"><i class="fa fa-laptop"></i> 在线 </a></li>
<li class="active"><a href="/jlog/log_list/offline/" class="text-center"><i class="fa fa-bar-chart-o"></i> 历史记录 </a></li> <li class="active"><a href="{% url 'log_list' 'offline' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 历史记录 </a></li>
<li><a href="/jlog/log_list/exec/" class="text-center"><i class="fa fa-bar-chart-o"></i> 命令记录 </a></li> <li><a href="{% url 'log_list' 'exec' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 命令记录 </a></li>
<li><a href="/jlog/log_list/file/" class="text-center"><i class="fa fa-bar-chart-o"></i> 上传下载 </a></li> <li><a href="{% url 'log_list' 'file' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 上传下载 </a></li>
</ul> </ul>
</div> </div>
<form class="form-inline" action="" method="get"> <form class="form-inline" action="" method="get">
@ -119,9 +119,9 @@
<td class="text-center remote_ip"> {{ post.remote_ip }} </td> <td class="text-center remote_ip"> {{ post.remote_ip }} </td>
<td class="text-center"> {{ post.login_type }} </td> <td class="text-center"> {{ post.login_type }} </td>
{% ifnotequal session_role_id 0 %} {% ifnotequal session_role_id 0 %}
<td class="text-center"><a href="/jlog/history/?id={{ post.id }}" class="log_command"> 统计 </a></td> <td class="text-center"><a href="{% url 'log_history' %}?id={{ post.id }}" class="log_command"> 统计 </a></td>
{% endifnotequal %} {% endifnotequal %}
<td class="text-center"><a value="/jlog/record/?id={{ post.id }}" class="log_record"> 回放 </a></td> <td class="text-center"><a value="{% url 'log_record' %}?id={{ post.id }}" class="log_record"> 回放 </a></td>
<td class="text-center start_time"> {{ post.start_time|date:"Y-m-d H:i:s"}} </td> <td class="text-center start_time"> {{ post.start_time|date:"Y-m-d H:i:s"}} </td>
<td class="text-center end_time"> {{ post.end_time|date:"Y-m-d H:i:s" }} </td> <td class="text-center end_time"> {{ post.end_time|date:"Y-m-d H:i:s" }} </td>
</tr> </tr>

View File

@ -67,10 +67,10 @@
<div class="ibox-content"> <div class="ibox-content">
<div class="panel-options"> <div class="panel-options">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li class="active"><a href="/jlog/log_list/online/" class="text-center"><i class="fa fa-laptop"></i> 在线 </a></li> <li class="active"><a href="{% url 'log_list' 'online' %}" class="text-center"><i class="fa fa-laptop"></i> 在线 </a></li>
<li><a href="/jlog/log_list/offline/" class="text-center"><i class="fa fa-bar-chart-o"></i> 历史记录 </a></li> <li><a href="{% url 'log_list' 'offline' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 历史记录 </a></li>
<li><a href="/jlog/log_list/exec/" class="text-center"><i class="fa fa-bar-chart-o"></i> 命令记录 </a></li> <li><a href="{% url 'log_list' 'exec' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 命令记录 </a></li>
<li><a href="/jlog/log_list/file/" class="text-center"><i class="fa fa-bar-chart-o"></i> 上传下载 </a></li> <li><a href="{% url 'log_list' 'file' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 上传下载 </a></li>
<div class="" style="float: right"> <div class="" style="float: right">
<form id="search_form" method="get" action="" class="pull-right mail-search"> <form id="search_form" method="get" action="" class="pull-right mail-search">
<div class="input-group"> <div class="input-group">
@ -108,7 +108,7 @@
<td id="ip" class="text-center"> {{ post.host }} </td> <td id="ip" class="text-center"> {{ post.host }} </td>
<td id="remote_ip" class="text-center"> {{ post.remote_ip }} </td> <td id="remote_ip" class="text-center"> {{ post.remote_ip }} </td>
<td class="text-center"> {{ post.login_type }} </td> <td class="text-center"> {{ post.login_type }} </td>
<td class="text-center"><a href="/jlog/history/?id={{ post.id }}" class="log_command"> 统计 </a></td> <td class="text-center"><a href="{% url 'log_history' %}?id={{ post.id }}" class="log_command"> 统计 </a></td>
<td class="text-center"><a class="monitor" file_path="{{ post.log_path }}"> 监控 </a></td> <td class="text-center"><a class="monitor" file_path="{{ 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 }}", "{{ post.login_type }}")' /></td> <td class="text-center"><input type="button" id="cut" class="btn btn-danger btn-xs" name="cut" value="阻断" onclick='cut("{{ post.pid }}", "{{ post.login_type }}")' /></td>
<td class="text-center" id="start_time"> {{ post.start_time|date:"Y-m-d H:i:s" }} </td> <td class="text-center" id="start_time"> {{ post.start_time|date:"Y-m-d H:i:s" }} </td>

View File

@ -19,7 +19,7 @@
<td class="text-center" id="dept_name"> {{ post.dept_name }} </td> <td class="text-center" id="dept_name"> {{ post.dept_name }} </td>
<td class="text-center" id="host"> {{ post.host }} </td> <td class="text-center" id="host"> {{ post.host }} </td>
<td class="text-center" id="remote_ip"> {{ post.remote_ip }} </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"><a href="{% url 'log_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="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> <td class="text-center" id="end_time"> {{ post.end_time|date:"Y-m-d H:i:s" }} </td>
</tr> </tr>

View File

@ -1,155 +0,0 @@
{% 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-sm-10">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5> {{ user_group.name }}授权修改</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>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
</div>
<div class="ibox-content">
<form id="userPerm" method="post" class="form-horizontal" action="../perm_group_edit/?id={{ user_group.id }}">
{% if error %}
<div class="alert alert-warning text-center">{{ error }}</div>
{% endif %}
{% if msg %}
<div class="alert alert-success text-center">{{ msg }}</div>
{% endif %}
<div class="row">
<div class="form-group">
<label for="" class="col-sm-2 control-label">用户组<span class="red-fonts">*</span></label>
<div class="col-sm-4">
<input id="user_group_name" name="user_group_name" type="text" class="form-control" value="{{ user_group.name }}" readonly>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">资产<span class="red-fonts">*</span></label>
<div class="col-sm-4">
<div>
<select id="assets" name="assets" class="form-control m-b" size="12" multiple>
{% for asset in assets %}
<option value="{{ asset.id }}">{{ asset.ip }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="col-sm-1">
<div class="btn-group" style="margin-top: 42px;">
<button type="button" class="btn btn-white" onclick="move('assets', 'asset_select')"><i class="fa fa-chevron-right"></i></button>
<button type="button" class="btn btn-white" onclick="move('asset_select', 'assets')"><i class="fa fa-chevron-left"></i> </button>
</div>
</div>
<div class="col-sm-3">
<div>
<select id="asset_select" name="asset_select" class="form-control m-b" size="12" multiple>
{% for asset in asset_permed %}
<option value="{{ asset.id }}">{{ asset.ip }}</option>
{% endfor %}
</select>
</div>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">资产组<span class="red-fonts">*</span></label>
<div class="col-sm-4">
<div>
<select id="asset_groups" name="asset_groups" class="form-control m-b" size="12" multiple>
{% for asset_group in asset_groups %}
<option value="{{ asset_group.id }}">{{ asset_group.name }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="col-sm-1">
<div class="btn-group" style="margin-top: 42px;">
<button type="button" class="btn btn-white" onclick="move('asset_groups', 'asset_groups_select')"><i class="fa fa-chevron-right"></i></button>
<button type="button" class="btn btn-white" onclick="move('asset_groups_select', 'asset_groups')"><i class="fa fa-chevron-left"></i> </button>
</div>
</div>
<div class="col-sm-3">
<div>
<select id="asset_groups_select" name="asset_groups_select" class="form-control m-b" size="12" multiple>
{% for asset_group in asset_group_permed %}
<option value="{{ asset_group.id }}">{{ asset_group.name }}</option>
{% endfor %}
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="form-group">
<div class="col-sm-4 col-sm-offset-2">
<button class="btn btn-white" type="reset">取消</button>
<button id="submit_button" class="btn btn-primary" type="submit" onclick="selectAll()">确认保存</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
$('#sudoPerm').validator({
timely: 2,
theme: "yellow_right_effect",
fields: {
"name": {
rule: "required",
tip: "输入授权名",
ok: "",
msg: {required: "必须填写!"}
}
},
valid: function(form) {
form.submit();
}
});
$(document).ready(function(){
$("#submit_button").click(function(){
$('#user_groups_select option').each(function(){
$(this).prop('selected', true)
})
$('#asset_groups_select option').each(function(){
$(this).prop('selected', true)
})
})
})
</script>
{% endblock %}

View File

@ -1,81 +0,0 @@
{% 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-sm-10">
<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>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
</div>
<div class="ibox-content">
<div class="">
<a target="_blank" href="/juser/group_add/" class="btn btn-sm btn-primary "> 添加用户组 </a>
<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="search" placeholder="Search">
<div class="input-group-btn">
<button id='search_btn' type="submit" class="btn btn-sm btn-primary">
- 搜索 -
</button>
</div>
</div>
</form>
</div>
<table class="table table-striped table-bordered table-hover " id="editable" >
<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>
</tr>
</thead>
<tbody>
{% for user_group in user_groups.object_list %}
<tr class="gradeX">
<td class="text-center"> {{ user_group.name }} </td>
<td class="text-center">
<a href="/juser/user_list/?gid={{ user_group.id }}">{{ user_group.user_set.all | length }} </a>
</td>
<td class="text-center"> <a href="/jasset/asset_list/?gid={{ user_group.id }}">{{ user_group | user_asset_count }} </a> </td>
<td class="text-center"> <a href="/jasset/group_list/?gid={{ user_group.id }}">{{ user_group | user_asset_group_count }}</a></td>
<td class="text-center">
<a href="../perm_user_detail/?id={{ user_group.id }}" class="btn btn-xs btn-primary">详情</a>
<a href="../perm_group_edit/?id={{ user_group.id }}" class="btn btn-xs btn-danger">编辑</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="row">
<div class="col-sm-6">
<div class="dataTables_info" id="editable_info" role="status" aria-live="polite">
Showing {{ users.start_index }} to {{ users.end_index }} of {{ p.count }} entries
</div>
</div>
{% include 'paginator.html' %}
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -36,7 +36,7 @@
{% for rule in rules %} {% for rule in rules %}
<tr class="gradeX"> <tr class="gradeX">
<td class="text-left"> {{ rule.date_added | date:"Y-m-d H:i:s"}} </td> <td class="text-left"> {{ rule.date_added | date:"Y-m-d H:i:s"}} </td>
<td class="text-right"> <a href="/jperm/perm_rule_detail/?id={{ rule.id }}">{{ rule.name }}</a> </td> <td class="text-right"> <a href="{% url 'rule_detail' %}?id={{ rule.id }}">{{ rule.name }}</a> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
@ -77,7 +77,7 @@
<table class="table progress-striped text-left"> <table class="table progress-striped text-left">
{% for user in users %} {% for user in users %}
<tr class="gradeX"> <tr class="gradeX">
<td> <a href="/jasset/asset_detail/?id={{ user.id }}">{{ user.name }}</a> </td> <td> <a href="{% url 'asset_detail' %}?id={{ user.id }}">{{ user.name }}</a> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
@ -86,7 +86,7 @@
<table class="table progress-striped text-right"> <table class="table progress-striped text-right">
{% for group in user_groups %} {% for group in user_groups %}
<tr class="gradeX-"> <tr class="gradeX-">
<td> <a href="/jasset/asset_list/?group_id={{ group.id }}">{{ group.name }}</a> </td> <td> <a href="{% url 'asset_list' %}?group_id={{ group.id }}">{{ group.name }}</a> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
@ -130,7 +130,7 @@
<table class="table progress-striped text-left"> <table class="table progress-striped text-left">
{% for asset in assets %} {% for asset in assets %}
<tr class="gradeX"> <tr class="gradeX">
<td> <a href="/jasset/asset_detail/?id={{ asset.id }}">{{ asset.ip }}</a> </td> <td> <a href="{% url 'asset_detail' %}?id={{ asset.id }}">{{ asset.ip }}</a> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
@ -139,7 +139,7 @@
<table class="table progress-striped text-right"> <table class="table progress-striped text-right">
{% for group in asset_groups %} {% for group in asset_groups %}
<tr class="gradeX-"> <tr class="gradeX-">
<td> <a href="/jasset/asset_list/?group_id={{ group.id }}">{{ group.name }}</a> </td> <td> <a href="{% url 'asset_list' %}?group_id={{ group.id }}">{{ group.name }}</a> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
@ -207,7 +207,7 @@
{% else %} {% else %}
<td class="text-center" style="color: #ec4758;cursor: help" title="{{ info.result }}" >{{ info.success | yesno:"成功,失败,未知" }} </td> <td class="text-center" style="color: #ec4758;cursor: help" title="{{ info.result }}" >{{ info.success | yesno:"成功,失败,未知" }} </td>
{% endif %} {% endif %}
<td class="text-center" ><a class="fa fa-times del" href="/jperm/role/recycle/?role_id={{ role.id }}&asset_id={{ asset.id }}" style="color: #ec4758;"></a></td> <td class="text-center" ><a class="fa fa-times del" href="{% url 'role_recycle' %}?role_id={{ role.id }}&asset_id={{ asset.id }}" style="color: #ec4758;"></a></td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>

View File

@ -31,8 +31,7 @@
</div> </div>
<div class="ibox-content"> <div class="ibox-content">
<div class=""> <div class="">
<a href="/jperm/role/perm_role_add/" class="btn btn-sm btn-primary "> 添加角色 </a> <a href="{% url 'role_add' %}" class="btn btn-sm btn-primary "> 添加角色 </a>
{# <a href="/jperm/role/perm_role_push/" class="btn btn-sm btn-danger "> 推送角色 </a>#}
<form id="search_form" method="get" action="" class="pull-right mail-search"> <form id="search_form" method="get" action="" class="pull-right mail-search">
<div class="input-group"> <div class="input-group">
<input type="text" class="form-control input-sm" id="search_input" name="search" placeholder="Search"> <input type="text" class="form-control input-sm" id="search_input" name="search" placeholder="Search">
@ -56,12 +55,12 @@
<tbody id="edittbody"> <tbody id="edittbody">
{% for role in roles %} {% for role in roles %}
<tr class="gradeX" id={{ role.id }}> <tr class="gradeX" id={{ role.id }}>
<td class="text-center"><a href="/jperm/role/perm_role_detail/?id={{ role.id }}">{{ role.name }} </a></td> <td class="text-center"><a href="{% url 'role_detail' %}?id={{ role.id }}">{{ role.name }} </a></td>
<td class="text-center"> {{ role | role_contain_which_sudos }} </td> <td class="text-center"> {{ role | role_contain_which_sudos }} </td>
<td class="text-center"> {{ role.date_added | date:"Y-m-d H:i:s"}} </td> <td class="text-center"> {{ role.date_added | date:"Y-m-d H:i:s"}} </td>
<td class="text-center"> <td class="text-center">
<a href="/jperm/role/perm_role_edit/?id={{ role.id }}" class="btn btn-xs btn-info">编辑</a> <a href="{% url 'role_edit' %}?id={{ role.id }}" class="btn btn-xs btn-info">编辑</a>
<a href="/jperm/role/push/?id={{ role.id }}" class="btn btn-xs btn-warning">推送</a> <a href="{% url 'role_push' %}?id={{ role.id }}" class="btn btn-xs btn-warning">推送</a>
<button onclick="remove_role({{ role.id }})" class="btn btn-xs btn-danger">删除</button> <button onclick="remove_role({{ role.id }})" class="btn btn-xs btn-danger">删除</button>
</td> </td>
</tr> </tr>

View File

@ -92,7 +92,7 @@
<table class="table progress-striped text-left"> <table class="table progress-striped text-left">
{% for user in users %} {% for user in users %}
<tr class="gradeX"> <tr class="gradeX">
<td> <a href="/jasset/asset_detail/?id={{ user.id }}">{{ user.name }}</a> </td> <td> <a href="{% url 'asset_detail' %}?id={{ user.id }}">{{ user.name }}</a> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
@ -101,7 +101,7 @@
<table class="table progress-striped text-right"> <table class="table progress-striped text-right">
{% for group in user_groups %} {% for group in user_groups %}
<tr class="gradeX-"> <tr class="gradeX-">
<td> <a href="/jasset/asset_list/?group_id={{ group.id }}">{{ group.name }}</a> </td> <td> <a href="{% url 'asset_list' %}?group_id={{ group.id }}">{{ group.name }}</a> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
@ -145,7 +145,7 @@
<table class="table progress-striped text-left"> <table class="table progress-striped text-left">
{% for asset in assets %} {% for asset in assets %}
<tr class="gradeX"> <tr class="gradeX">
<td> <a href="/jasset/asset_detail/?id={{ asset.id }}">{{ asset.ip }}</a> </td> <td> <a href="{% url 'asset_list' %}?id={{ asset.id }}">{{ asset.ip }}</a> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
@ -154,7 +154,7 @@
<table class="table progress-striped text-right"> <table class="table progress-striped text-right">
{% for group in asset_groups %} {% for group in asset_groups %}
<tr class="gradeX-"> <tr class="gradeX-">
<td> <a href="/jasset/asset_list/?group_id={{ group.id }}">{{ group.name }}</a> </td> <td> <a href="{% url 'asset_list' %}?group_id={{ group.id }}">{{ group.name }}</a> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View File

@ -34,7 +34,7 @@
<div class="ibox-content"> <div class="ibox-content">
<div class=""> <div class="">
<a href="/jperm/perm_rule_add/" class="btn btn-sm btn-primary "> 添加规则 </a> <a href="{% url 'rule_add' %}" class="btn btn-sm btn-primary "> 添加规则 </a>
<form id="search_form" method="get" action="" class="pull-right mail-search"> <form id="search_form" method="get" action="" class="pull-right mail-search">
<div class="input-group"> <div class="input-group">
<input type="text" class="form-control input-sm" id="search_input" name="search" placeholder="Search"> <input type="text" class="form-control input-sm" id="search_input" name="search" placeholder="Search">
@ -62,7 +62,7 @@
<tbody id="edittbody"> <tbody id="edittbody">
{% for rule in rules %} {% for rule in rules %}
<tr class="gradeX" id={{ rule.id }}> <tr class="gradeX" id={{ rule.id }}>
<td class="text-center"> <a href="/jperm/perm_rule_detail/?id={{ rule.id }}" >{{ rule.name }}</a> </td> <td class="text-center"> <a href="{% url 'rule_detail' %}?id={{ rule.id }}" >{{ rule.name }}</a> </td>
<td class="text-center"> <td class="text-center">
{{ rule | rule_member_count:"user" }} {{ rule | rule_member_count:"user" }}
</td> </td>
@ -79,7 +79,7 @@
{{ rule | rule_member_count:"role" }} {{ rule | rule_member_count:"role" }}
</td> </td>
<td class="text-center"> <td class="text-center">
<a href="/jperm/perm_rule_edit/?id={{ rule.id }}" class="btn btn-xs btn-info">编辑</a> <a href="{% url 'rule_edit' %}?id={{ rule.id }}" class="btn btn-xs btn-info">编辑</a>
<button onclick="remove_rule({{ rule.id }})" class="btn btn-xs btn-danger">删除</button> <button onclick="remove_rule({{ rule.id }})" class="btn btn-xs btn-danger">删除</button>
</td> </td>
</tr> </tr>

View File

@ -32,7 +32,7 @@
<div class="ibox-content"> <div class="ibox-content">
<div class=""> <div class="">
<a href="/jperm/sudo/perm_sudo_add/" class="btn btn-sm btn-primary "> 添加别名 </a> <a href="{% url 'sudo_add' %}" class="btn btn-sm btn-primary "> 添加别名 </a>
<form id="search_form" method="get" action="" class="pull-right mail-search"> <form id="search_form" method="get" action="" class="pull-right mail-search">
<div class="input-group"> <div class="input-group">
<input type="text" class="form-control input-sm" id="search_input" name="search" placeholder="Search"> <input type="text" class="form-control input-sm" id="search_input" name="search" placeholder="Search">
@ -62,7 +62,7 @@
<td class="text-center"> {{ sudo.date_added | date:"Y-m-d H:i:s"}} </td> <td class="text-center"> {{ sudo.date_added | date:"Y-m-d H:i:s"}} </td>
<td class="text-center"> <td class="text-center">
{# <a href="/jperm/sudo/perm_sudo_detail/?id={{ sudo.id }}" class="btn btn-xs btn-primary">详情</a>#} {# <a href="/jperm/sudo/perm_sudo_detail/?id={{ sudo.id }}" class="btn btn-xs btn-primary">详情</a>#}
<a href="/jperm/sudo/perm_sudo_edit/?id={{ sudo.id }}" class="btn btn-xs btn-info">编辑</a> <a href="{% url 'sudo_edit' %}?id={{ sudo.id }}" class="btn btn-xs btn-info">编辑</a>
<button onclick="remove_sudo({{ sudo.id }})" class="btn btn-xs btn-danger">删除</button> <button onclick="remove_sudo({{ sudo.id }})" class="btn btn-xs btn-danger">删除</button>
</td> </td>
</tr> </tr>

View File

@ -1,130 +0,0 @@
{% 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-sm-10">
<div class="ibox float-e-margins">
<div class="panel blank-panel">
<div class="panel-heading">
<div class="panel-options">
<ul class="nav nav-tabs">
<li id="tab1" class=""><a href="/jperm/sys_user_list/" >查看系统用户</a></li>
<li id="tab2" class="active"><a href="/jperm/sys_user_add/">添加系统用户</a></li>
</ul>
</div>
</div>
<div class="panel-body">
<div class="tab-content">
<div id="tab-default" class="tab-pane active">
<form method="post" id="userForm" class="form-horizontal" action="">
{% if error %}
<div class="alert alert-warning text-center">{{ error }}</div>
{% endif %}
{% if msg %}
<div class="alert alert-success text-center">{{ msg }}</div>
{% endif %}
<div class="form-group">
<label for="username" class="col-sm-2 control-label">用户名<span class="red-fonts">*</span></label>
<div class="col-sm-8">
<input id="username" name="username" placeholder="Username" type="text" class="form-control" {% if error %}value="{{ username }}" {% endif %}>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="password" class="col-sm-2 control-label">密码<span class="red-fonts">*</span></label>
<div class="col-sm-8">
<input id="password" name="password" placeholder="Password" type="password" class="form-control" {% if error %}value="{{ password }}" {% endif %} >
<span class="help-block m-b-none">通常在其它硬件上使用服务器会使用自动生成的key</span>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">推送资产组<span class="red-fonts">*</span></label>
<div class="col-sm-4">
<div>
<select id="asset_groups" name="asset_groups" class="form-control" size="12" multiple>
{% for asset_group in asset_group_all %}
<option value="{{ asset_group.id }}">{{ asset_group.name }}</option>
{% endfor %}
</select>
<span class="help-block m-b-none">将在以上资产组服务器新建系统用户</span>
</div>
</div>
<div class="col-sm-1">
<div class="btn-group" style="margin-top: 42px;">
<button type="button" class="btn btn-white" onclick="move('asset_groups', 'asset_groups_select')"><i class="fa fa-chevron-right"></i></button>
<button type="button" class="btn btn-white" onclick="move('asset_groups_select', 'asset_groups')"><i class="fa fa-chevron-left"></i> </button>
</div>
</div>
<div class="col-sm-3">
<div>
<select id="asset_groups_select" name="asset_groups_select" class="form-control m-b" size="12" multiple>
</select>
</div>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="comment" class="col-sm-2 control-label">备注<span class="red-fonts">*</span></label>
<div class="col-sm-8">
<input id="comment" name="comment" placeholder="Comment" type="text" class="form-control" {% if error %}value="{{ comment }}" {% endif %} >
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<div class="col-sm-4 col-sm-offset-2">
<button class="btn btn-white" type="reset">取消</button>
<button id="submit_button" class="btn btn-primary" type="submit">确认保存</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block self_footer_js %}
<script>
$('#userForm').validator({
timely: 2,
theme: "yellow_right_effect",
rules: {
check_username: [/^\w{3,20}$/, '大小写字母数字和下划线'],
type_m: function(element){
return $("#M").is(":checked");
}
},
fields: {
"username": {
rule: "required;check_username",
tip: "输入用户名",
ok: "",
msg: {required: "必须填写!"}
},
"password": {
rule: "required;length[6~50]",
tip: "输入密码",
ok: "",
msg: {required: "必须填写!"}
}
},
valid: function(form) {
form.submit();
}
});
</script>
{% endblock %}

View File

@ -1,102 +0,0 @@
{% 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-sm-12">
<div class="ibox float-e-margins">
<div class="panel blank-panel">
<div class="panel-heading">
<div class="panel-options">
<ul class="nav nav-tabs">
<li id="tab1" class="active"><a href="/jperm/sys_user_list/" >查看系统用户</a></li>
<li id="tab2" class=""><a href="/jperm/sys_user_add/">添加系统用户</a></li>
</ul>
</div>
</div>
<div class="panel-body">
<div class="tab-content">
<div id="tab-default" class="tab-pane active">
<div class="ibox-content">
<table class="table table-striped table-bordered table-hover " id="editable" >
<thead>
<tr>
<th class="text-center">
<input type="checkbox" name="select_all" onclick="selectAll()">
</th>
<th class="text-center">用户名</th>
<th class="text-center">操作</th>
</tr>
</thead>
<tbody>
{% for user in users.object_list %}
<tr class="gradeX">
<td class="text-center">
<input type="checkbox" name="selected" value="{{ user.id }}">
</td>
<td class="text-center"> {{ user.username }} </td>
<td class="text-center">
<a href="../user_detail/?id={{ user.id }}" class="btn btn-xs btn-primary">详情</a>
<a href="../user_edit/?id={{ user.id }}" class="btn btn-xs btn-info">编辑</a>
<a value="../user_del/?id={{ user.id }}" class="btn btn-xs btn-danger del {% if user.username == 'admin' %} disabled {% endif %}">删除</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="row">
<div class="col-sm-6">
<div class="dataTables_info" id="editable_info" role="status" aria-live="polite">
Showing {{ users.start_index }} to {{ users.end_index }} of {{ p.count }} entries
</div>
</div>
{% include 'paginator.html' %}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block self_head_css_js %}
<script>
$(document).ready(function(){
$('.del').click(function(){
var row = $(this).closest('tr');
$.get(
$(this).attr('value'),
{},
function(data){
row.remove();
alert(data);
}
)
});
$('#del_btn').click(function(){
var check_array = [];
if (confirm("确定删除")) {
$(".gradeX input:checked").each(function() {
check_array.push($(this).attr("value"))
});
$.post("/juser/user_del/",
{id: check_array.join(",")},
function(data){
$(".gradeX input:checked").closest("tr").remove();
alert(data);
}
)
}
});
});
</script>
{% endblock %}

View File

@ -25,7 +25,7 @@
<div class="ibox-content"> <div class="ibox-content">
<div class=""> <div class="">
<a href="/juser/group_add/" class="btn btn-sm btn-primary "> 添加用户组 </a> <a href="{% url 'user_group_add' %}" class="btn btn-sm btn-primary "> 添加用户组 </a>
<a id="del_btn" class="btn btn-sm btn-danger "> 删除所选 </a> <a id="del_btn" class="btn btn-sm btn-danger "> 删除所选 </a>
<form id="search_form" method="get" action="" class="pull-right mail-search"> <form id="search_form" method="get" action="" class="pull-right mail-search">
<div class="input-group"> <div class="input-group">
@ -59,12 +59,12 @@
</td> </td>
<td class="text-center"> {{ group.name }} </td> <td class="text-center"> {{ group.name }} </td>
<td class="text-center"> <td class="text-center">
<a href="/juser/user_list/?gid={{ group.id }}"> {{ group.id | members_count }}</a> <a href="{% url 'user_list' %}?gid={{ group.id }}"> {{ group.id | members_count }}</a>
</td> </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_edit/?id={{ group.id }}" class="btn btn-xs btn-info">编辑</a> <a href="{% url 'user_group_edit' %}?id={{ group.id }}" class="btn btn-xs btn-info">编辑</a>
<a value="../group_del/?id={{ group.id }}" class="btn btn-xs btn-danger del">删除</a> <a value="{% url 'user_group_del' %}?id={{ group.id }}" class="btn btn-xs btn-danger del">删除</a>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
@ -112,7 +112,7 @@
$(".gradeX input:checked").each(function() { $(".gradeX input:checked").each(function() {
check_array.push($(this).attr("value")) check_array.push($(this).attr("value"))
}); });
$.get("/juser/group_del/", $.get("{% url 'user_group_del' %}",
{id: check_array.join(",")}, {id: check_array.join(",")},
function(result){ function(result){
alert(result); alert(result);

View File

@ -51,7 +51,7 @@
<tr> <tr>
<td class="text-navy">key</td> <td class="text-navy">key</td>
{% if user.username|key_exist %} {% if user.username|key_exist %}
<td><a href="/juser/down_key/?id={{ user.id }}" >下载</a></td> <td><a href="{% url 'key_down' %}?id={{ user.id }}" >下载</a></td>
{% else %} {% else %}
<td><span style="color: #586b7d">下载</span></td> <td><span style="color: #586b7d">下载</span></td>
{% endif %} {% endif %}
@ -78,7 +78,7 @@
<table class="table"> <table class="table">
{% for group in user.group.all %} {% for group in user.group.all %}
<tr> <tr>
<td><a href="/jperm/perm_edit/?id={{ group.id }}">{{ group.name }}</a></td> <td><a href="{% url 'user_group_list' %}?id={{ group.id }}">{{ group.name }}</a></td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
@ -96,7 +96,7 @@
<table class="table"> <table class="table">
{% for group in user_perm_info.asset_group.keys%} {% for group in user_perm_info.asset_group.keys%}
<tr> <tr>
<td><a href="/jasset/group_list/?id={{ group.id }}">{{ group.name }}</a></td> <td><a href="{% url 'user_group_list' %}?id={{ group.id }}">{{ group.name }}</a></td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
@ -108,7 +108,7 @@
<table class="table"> <table class="table">
{% for rule in user_perm_info.rule%} {% for rule in user_perm_info.rule%}
<tr> <tr>
<td><a href="/jperm/role/?id={{ rule.id }}">{{ rule.name }}</a></td> <td><a href="{% url 'role_list' %}?id={{ rule.id }}">{{ rule.name }}</a></td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
@ -149,7 +149,7 @@
<div class="col-xs-3 date"> <div class="col-xs-3 date">
<i class="fa fa-info"></i> <i class="fa fa-info"></i>
<b> <b>
<a href="/jperm/role/&id={{ role.id }}">{{ role.name }}</a></b> <a href="{% url 'role_list' %}?id={{ role.id }}">{{ role.name }}</a></b>
<br> <br>
<small class="text-navy">共: {{ assets.asset | length }}台</small> <small class="text-navy">共: {{ assets.asset | length }}台</small>
</div> </div>
@ -158,7 +158,7 @@
<strong>{{ role.comment }}</strong></p> <strong>{{ role.comment }}</strong></p>
<p> <p>
{% for asset in assets.asset %} {% for asset in assets.asset %}
<a href="/jasset/asset_list/?id={{ asset.id }}">{{ asset.hostname }}</a><br> <a href="{% url 'asset_list' %}?id={{ asset.id }}">{{ asset.hostname }}</a><br>
{% endfor %} {% endfor %}
</p> </p>
<p></p> <p></p>

View File

@ -24,7 +24,7 @@
<div class="ibox-content"> <div class="ibox-content">
<div class=""> <div class="">
<a href="/juser/user_add/" class="btn btn-sm btn-primary "> 添加用户 </a> <a href="{% url 'user_add' %}" class="btn btn-sm btn-primary "> 添加用户 </a>
<a id="del_btn" class="btn btn-sm btn-danger "> 删除所选 </a> <a id="del_btn" class="btn btn-sm btn-danger "> 删除所选 </a>
<form id="search_form" method="get" action="" class="pull-right mail-search"> <form id="search_form" method="get" action="" class="pull-right mail-search">
<div class="input-group"> <div class="input-group">
@ -60,7 +60,7 @@
<td class="text-center"> <td class="text-center">
<input type="checkbox" name="checked" value="{{ user.id }}"> <input type="checkbox" name="checked" value="{{ user.id }}">
</td> </td>
<td class="text-center"><a href="../user_detail/?id={{ user.id }}">{{ user.username }}</a></td> <td class="text-center"><a href="{% url 'user_detail' %}?id={{ user.id }}">{{ user.username }}</a></td>
<td class="text-center"> {{ user.name }} </td> <td class="text-center"> {{ user.name }} </td>
<td class="text-center" title="{% for user_group in user.group.all %} {{ user_group.name }} {% endfor %}"> {{ user.group.all | groups2str }} </td> <td class="text-center" title="{% for user_group in user.group.all %} {{ user_group.name }} {% endfor %}"> {{ user.group.all | groups2str }} </td>
<td class="text-center"> {{ user.id | get_role }}</td> <td class="text-center"> {{ user.id | get_role }}</td>
@ -68,15 +68,15 @@
<td class="text-center">{{ user.is_active | bool2str }}</td> <td class="text-center">{{ user.is_active | bool2str }}</td>
<td class="text-center"> <td class="text-center">
{% if user.username|key_exist %} {% if user.username|key_exist %}
<a href="/juser/down_key/?uuid={{ user.uuid }}" >下载</a> <a href="{% url 'key_down' %}?uuid={{ user.uuid }}" >下载</a>
{% else %} {% else %}
<span style="color: #586b7d">下载</span> <span style="color: #586b7d">下载</span>
{% endif %} {% endif %}
</td> </td>
<td class="text-center"> <td class="text-center">
<a href="../user_edit/?id={{ user.id }}" class="btn btn-xs btn-info">编辑</a> <a href="{% url 'user_edit' %}/?id={{ user.id }}" class="btn btn-xs btn-info">编辑</a>
<a value="{{ user.uuid }}" class="btn btn-xs btn-warning email">Email</a> <a value="{{ user.uuid }}" class="btn btn-xs btn-warning email">Email</a>
<a value="../user_del/?id={{ user.id }}" class="btn btn-xs btn-danger del {% if user.username == 'admin' %} disabled {% endif %}">删除</a> <a value="{% url 'user_del' %}?id={{ user.id }}" class="btn btn-xs btn-danger del {% if user.username == 'admin' %} disabled {% endif %}">删除</a>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
@ -124,7 +124,7 @@
check_array.push($(this).attr("value")) check_array.push($(this).attr("value"))
}); });
console.log(check_array.join(",")); console.log(check_array.join(","));
$.post("/juser/user_del/", $.post("{% url 'user_del' %}",
{id: check_array.join(",")}, {id: check_array.join(",")},
function(data){ function(data){
$(".gradeX input:checked").closest("tr").remove(); $(".gradeX input:checked").closest("tr").remove();
@ -136,7 +136,7 @@
}); });
$('.email').click(function(){ $('.email').click(function(){
$.get('/juser/send_mail_retry/?uuid=' + $(this).attr('value'), $.get('{% url "mail_retry" %}?uuid=' + $(this).attr('value'),
{}, {},
function(data){ function(data){
alert(data) alert(data)

View File

@ -31,7 +31,7 @@
</div> </div>
<button type="submit" class="btn btn-primary block full-width m-b">Login</button> <button type="submit" class="btn btn-primary block full-width m-b">Login</button>
<a href="/juser/forget_password/"><small>Forgot password? </small></a> <a href="{% url 'password_forget' %}"><small>Forgot password? </small></a>
</form> </form>
<p class="m-t"> <small><b>Copyright</b> Jumpserver.org Organization © 2014-2015</small> </p> <p class="m-t"> <small><b>Copyright</b> Jumpserver.org Organization © 2014-2015</small> </p>
</div> </div>

View File

@ -4,49 +4,49 @@
<ul class="nav" id="side-menu"> <ul class="nav" id="side-menu">
{% include 'nav_li_profile.html' %} {% include 'nav_li_profile.html' %}
<li id="index"> <li id="index">
<a href="/"><i class="fa fa-dashboard"></i> <span class="nav-label">仪表盘</span><span class="label label-info pull-right"></span></a> <a href="{% url 'index' %}"><i class="fa fa-dashboard"></i> <span class="nav-label">仪表盘</span><span class="label label-info pull-right"></span></a>
</li> </li>
<li id="juser"> <li id="juser">
<a href="#"><i class="fa fa-group"></i> <span class="nav-label">用户管理</span><span class="fa arrow"></span></a> <a href="#"><i class="fa fa-group"></i> <span class="nav-label">用户管理</span><span class="fa arrow"></span></a>
<ul class="nav nav-second-level"> <ul class="nav nav-second-level">
<li class="group_list group_edit group_add"><a href="/juser/group_list/">查看用户组</a></li> <li class="group"><a href="{% url 'user_group_list' %}">查看用户组</a></li>
<li class="user_list user_edit user_detail user_add"><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"><a href="{% url '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>
</ul> </ul>
</li> </li>
<li id="jasset"> <li id="jasset">
<a><i class="fa fa-inbox"></i> <span class="nav-label">资产管理</span><span class="fa arrow"></span></a> <a><i class="fa fa-inbox"></i> <span class="nav-label">资产管理</span><span class="fa arrow"></span></a>
<ul class="nav nav-second-level"> <ul class="nav nav-second-level">
<li class="group_list group_detail group_edit"><a href="/jasset/group_list/">查看资产组</a></li> <li class="group"><a href="{% url 'asset_group_list' %}">查看资产组</a></li>
<li class="asset_list asset_detail asset_edit asset_add asset_add_batch"><a href="/jasset/asset_list/">查看资产<span class="label label-info pull-right">{{ host_active_num }}/{{ host_total_num}}</span></a></li> <li class="asset"> <a href="{% url 'asset_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/">查看机房</a></li> <li class="idc"> <a href="{% url 'idc_list' %}">查看机房</a></li>
</ul> </ul>
</li> </li>
<li id="jperm"> <li id="jperm">
<a href="#"><i class="fa fa-edit"></i> <span class="nav-label">授权管理</span><span class="fa arrow"></span></a> <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"> <ul class="nav nav-second-level">
<li class="sudo"> <li class="sudo">
<a href="/jperm/sudo/">Sudo命令</a> <a class="sudo" href="{% url 'sudo_list' %}">Sudo命令</a>
</li> </li>
<li class="role"> <li class="role">
<a href="/jperm/role/">系统角色</a> <a href="{% url 'role_list' %}">系统角色</a>
</li> </li>
<li class="rule perm_rule_add perm_rule_detail perm_rule_edit"> <li class="rule">
<a href="/jperm/rule/">授权规则</a> <a href="{% url 'rule_list' %}">授权规则</a>
</li> </li>
</ul> </ul>
</li> </li>
<li id="jlog"> <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> <a href="{% url '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>
<li id="file"> <li id="file">
<a href="#"><i class="fa fa-download"></i> <span class="nav-label">上传下载</span><span class="fa arrow"></span></a> <a href="#"><i class="fa fa-download"></i> <span class="nav-label">上传下载</span><span class="fa arrow"></span></a>
<ul class="nav nav-second-level"> <ul class="nav nav-second-level">
<li class="upload"><a href="/file/upload/">文件上传</a></li> <li class="upload"><a href="{% url 'file_upload' %}">文件上传</a></li>
<li class="download"><a href="/file/download/">文件下载</a></li> <li class="download"><a href="{% url 'file_download' %}">文件下载</a></li>
</ul> </ul>
</li> </li>
<li id="setting"> <li id="setting">
<a href="/setting/"><i class="fa fa-gears"></i> <span class="nav-label">设置</span><span class="label label-info pull-right"></span></a> <a href="{% url 'setting' %}"><i class="fa fa-gears"></i> <span class="nav-label">设置</span><span class="label label-info pull-right"></span></a>
</li> </li>
<li class="special_link"> <li class="special_link">
<a href="http://www.jumpserver.org" target="_blank"><i class="fa fa-database"></i> <span class="nav-label">访问官网</span></a> <a href="http://www.jumpserver.org" target="_blank"><i class="fa fa-database"></i> <span class="nav-label">访问官网</span></a>
@ -63,16 +63,16 @@
<ul class="nav" id="side-menu"> <ul class="nav" id="side-menu">
{% include 'nav_li_profile.html' %} {% include 'nav_li_profile.html' %}
<li id="juser"> <li id="juser">
<a href="/juser/user_detail/"><i class="fa fa-dashboard"></i> <span class="nav-label">仪表盘</span><span class="label label-info pull-right"></span></a> <a href="{% url 'user_detail' %}"><i class="fa fa-dashboard"></i> <span class="nav-label">仪表盘</span><span class="label label-info pull-right"></span></a>
</li> </li>
<li id="jasset"> <li id="jasset">
<a href="/jasset/asset_list/"><i class="fa fa-inbox"></i> <span class="nav-label">查看主机</span><span class="label label-info pull-right"></span></a> <a href="{% url 'asset_list' %}"><i class="fa fa-inbox"></i> <span class="nav-label">查看主机</span><span class="label label-info pull-right"></span></a>
</li> </li>
<li id="file"> <li id="file">
<a href="#"><i class="fa fa-download"></i> <span class="nav-label">上传下载</span><span class="fa arrow"></span></a> <a href="#"><i class="fa fa-download"></i> <span class="nav-label">上传下载</span><span class="fa arrow"></span></a>
<ul class="nav nav-second-level"> <ul class="nav nav-second-level">
<li class="upload"><a href="/file/upload/">文件上传</a></li> <li class="upload"><a href="{% url 'file_upload' %}">文件上传</a></li>
<li class="download"><a href="/file/download/">文件下载</a></li> <li class="download"><a href="{% url 'file_download' %}">文件下载</a></li>
</ul> </ul>
</li> </li>

View File

@ -22,7 +22,7 @@
{% for apply in apply_info %} {% for apply in apply_info %}
<li> <li>
<div class="dropdown-messages-box"> <div class="dropdown-messages-box">
<a href="/jperm/apply_show/online/" class="pull-left"> <a href="" class="pull-left">
<img alt="image" class="img-circle" src="/static/img/a4.jpg"> <img alt="image" class="img-circle" src="/static/img/a4.jpg">
</a> </a>
<div class="media-body"> <div class="media-body">
@ -38,7 +38,7 @@
{% endfor %} {% endfor %}
<li> <li>
<div class="text-center link-block"> <div class="text-center link-block">
<a href="/jperm/apply_show/online/"> <a href="">
<i class="fa fa-envelope"></i> <strong>Read All Messages</strong> <i class="fa fa-envelope"></i> <strong>Read All Messages</strong>
</a> </a>
</div> </div>
@ -71,7 +71,7 @@
{# </ul>#} {# </ul>#}
{# </li>#} {# </li>#}
<li> <li>
<a href="/logout/"> <a href="{% url 'logout' %}">
<i class="fa fa-sign-out"></i> Log out <i class="fa fa-sign-out"></i> Log out
</a> </a>
</li> </li>

View File

@ -3,7 +3,7 @@
<h2>{{ header_title }}</h2> <h2>{{ header_title }}</h2>
<ol class="breadcrumb"> <ol class="breadcrumb">
<li> <li>
<a href="/">仪表盘</a> <a href="{% url 'index' %}">仪表盘</a>
</li> </li>
<li> <li>
{% if path1 %} {% if path1 %}

View File

@ -15,8 +15,8 @@
</span> </span>
</a> </a>
<ul class="dropdown-menu animated fadeInRight m-t-xs"> <ul class="dropdown-menu animated fadeInRight m-t-xs">
<li><a value="/juser/profile/?id={{ session_user_id }}" class="iframe_user">个人信息</a></li> <li><a value="{% url 'user_profile' %}?id={{ session_user_id }}" class="iframe_user">个人信息</a></li>
<li><a href="/juser/change_info/">修改信息</a></li> <li><a href="{% url 'user_update' %}">修改信息</a></li>
{# {% if not user.role == 'CU' %}#} {# {% if not user.role == 'CU' %}#}
{# {% if request.session.role_id == 0 %}#} {# {% if request.session.role_id == 0 %}#}
{# <li><a href="/juser/change_role/">系统后台</a></li>#} {# <li><a href="/juser/change_role/">系统后台</a></li>#}
@ -25,7 +25,7 @@
{# {% endif %}#} {# {% endif %}#}
{# {% endif %}#} {# {% endif %}#}
<li class="divider"></li> <li class="divider"></li>
<li><a href="/logout/">注销</a></li> <li><a href="{% url 'logout' %}">注销</a></li>
</ul> </ul>
</div> </div>