mirror of https://github.com/jumpserver/jumpserver
someday
parent
06eedff49f
commit
50d2bfb272
|
@ -5,71 +5,7 @@ from juser.models import User, UserGroup
|
|||
from jasset.models import Asset, AssetGroup
|
||||
|
||||
|
||||
# class PermUserAsset(models.Model):
|
||||
# user = models.ForeignKey(User)
|
||||
# asset = models.ForeignKey(Asset)
|
||||
#
|
||||
# def __unicode__(self):
|
||||
# return self.user.username
|
||||
#
|
||||
#
|
||||
# class PermUserAssetGroup(models.Model):
|
||||
# user = models.ForeignKey(User)
|
||||
# asset_group = models.ForeignKey(AssetGroup)
|
||||
#
|
||||
# def __unicode__(self):
|
||||
# return self.user.username
|
||||
#
|
||||
#
|
||||
# class PermUserGroupAsset(models.Model):
|
||||
# user_group = models.ForeignKey(UserGroup)
|
||||
# asset = models.ForeignKey(Asset)
|
||||
#
|
||||
# def __unicode__(self):
|
||||
# return self.user_group.name
|
||||
#
|
||||
#
|
||||
# class PermUserGroupAssetGroup(models.Model):
|
||||
# user_group = models.ForeignKey(UserGroup)
|
||||
# asset_group = models.ForeignKey(AssetGroup)
|
||||
#
|
||||
# def __unicode__(self):
|
||||
# return self.user_group.name
|
||||
|
||||
|
||||
|
||||
# class CmdGroup(models.Model):
|
||||
# name = models.CharField(max_length=50, unique=True)
|
||||
# cmd = models.CharField(max_length=999)
|
||||
# comment = models.CharField(blank=True, null=True, max_length=50)
|
||||
#
|
||||
# def __unicode__(self):
|
||||
# return self.name
|
||||
#
|
||||
#
|
||||
# class SudoPerm(models.Model):
|
||||
# user_group = models.ForeignKey(UserGroup)
|
||||
# user_runas = models.CharField(max_length=100)
|
||||
# asset_group = models.ManyToManyField(AssetGroup)
|
||||
# cmd_group = models.ManyToManyField(CmdGroup)
|
||||
# comment = models.CharField(max_length=30, null=True, blank=True)
|
||||
#
|
||||
# def __unicode__(self):
|
||||
# return self.user_group.name
|
||||
#
|
||||
#
|
||||
# class Apply(models.Model):
|
||||
# uuid = UUIDField(auto=True)
|
||||
# applyer = models.CharField(max_length=20)
|
||||
# admin = models.CharField(max_length=20)
|
||||
# approver = models.CharField(max_length=20)
|
||||
# bisgroup = models.CharField(max_length=500)
|
||||
# asset = models.CharField(max_length=500)
|
||||
# comment = models.TextField(blank=True, null=True)
|
||||
# status = models.IntegerField(max_length=2)
|
||||
# date_add = models.DateTimeField(null=True)
|
||||
# date_end = models.DateTimeField(null=True)
|
||||
# read = models.IntegerField(max_length=2)
|
||||
#
|
||||
# def __unicode__(self):
|
||||
# return self.applyer
|
||||
class PermLog(models.Model):
|
||||
datetime = models.DateTimeField(auto_now_add=True)
|
||||
result = models.CharField(max_length=1000, null=True, blank=True, default='')
|
||||
is_finished = models.BooleanField(default=False)
|
||||
|
|
|
@ -6,6 +6,7 @@ import uuid
|
|||
import re
|
||||
from ansible.playbook import PlayBook
|
||||
from ansible import callbacks, utils
|
||||
from jumpserver.tasks import playbook_run, add
|
||||
|
||||
from jumpserver.models import Setting
|
||||
|
||||
|
@ -54,49 +55,6 @@ def get_playbook(template, var):
|
|||
return path
|
||||
|
||||
|
||||
def playbook_run(inventory, playbook, settings):
|
||||
stats = callbacks.AggregateStats()
|
||||
playbook_cb = callbacks.PlaybookCallbacks(verbose=utils.VERBOSITY)
|
||||
runner_cb = callbacks.PlaybookRunnerCallbacks(stats, verbose=utils.VERBOSITY)
|
||||
# run the playbook
|
||||
if settings:
|
||||
playbook = PlayBook(host_list=inventory,
|
||||
playbook=playbook,
|
||||
forks=5,
|
||||
remote_user=settings.default_user,
|
||||
remote_port=settings.default_port,
|
||||
private_key_file=settings.default_pri_key_path,
|
||||
callbacks=playbook_cb,
|
||||
runner_callbacks=runner_cb,
|
||||
stats=stats,
|
||||
become=True,
|
||||
become_user='root')
|
||||
else:
|
||||
playbook = PlayBook(host_list=inventory,
|
||||
playbook=playbook,
|
||||
forks=5,
|
||||
callbacks=playbook_cb,
|
||||
runner_callbacks=runner_cb,
|
||||
stats=stats,
|
||||
become=True,
|
||||
become_user='root')
|
||||
|
||||
results = playbook.run()
|
||||
results_r = {'unreachable': [], 'failures': [], 'success': []}
|
||||
for hostname, result in results.items():
|
||||
if result.get('unreachable', 2):
|
||||
results_r['unreachable'].append(hostname)
|
||||
print "%s >>> unreachable" % hostname
|
||||
elif result.get('failures', 2):
|
||||
results_r['failures'].append(hostname)
|
||||
print "%s >>> Failed" % hostname
|
||||
else:
|
||||
results_r['success'].append(hostname)
|
||||
print "%s >>> Success" % hostname
|
||||
|
||||
return results_r
|
||||
|
||||
|
||||
def perm_user_api(perm_info):
|
||||
"""
|
||||
用户授权api,通过调用ansible API完成用户新建等,传入参数必须如下,列表中可以是对象,也可以是用户名和ip
|
||||
|
@ -111,6 +69,8 @@ def perm_user_api(perm_info):
|
|||
new_assets = perm_info['new']['assets']
|
||||
del_users = perm_info['del']['users']
|
||||
del_assets = perm_info['del']['assets']
|
||||
|
||||
print new_users, new_assets
|
||||
except IndexError:
|
||||
raise ServerError("Error: function perm_user_api传入参数错误")
|
||||
|
||||
|
@ -125,8 +85,6 @@ def perm_user_api(perm_info):
|
|||
except IndexError:
|
||||
raise ServerError("Error: function perm_user_api传入参数错误")
|
||||
|
||||
print new_assets, del_assets
|
||||
print new_users, del_users
|
||||
try:
|
||||
if var_type == 'str':
|
||||
new_ip = new_assets
|
||||
|
@ -141,9 +99,6 @@ def perm_user_api(perm_info):
|
|||
except IndexError:
|
||||
raise ServerError("Error: function perm_user_api传入参数类型错误")
|
||||
|
||||
print new_ip, del_ip
|
||||
print new_username, del_username
|
||||
|
||||
host_group = {'new': new_ip, 'del': del_ip}
|
||||
inventory = get_inventory(host_group)
|
||||
|
||||
|
@ -155,9 +110,22 @@ def perm_user_api(perm_info):
|
|||
'the_new_users': the_new_users, 'the_del_users': the_del_users,
|
||||
'the_pub_key': '/tmp/id_rsa.pub'})
|
||||
|
||||
print playbook, inventory
|
||||
|
||||
settings = get_object(Setting, name='default')
|
||||
results_r = playbook_run(inventory, playbook, settings)
|
||||
return results_r
|
||||
results = playbook_run(inventory, playbook, settings)
|
||||
return results
|
||||
|
||||
|
||||
def get_user_assets(user):
|
||||
if isinstance(user, int):
|
||||
user = get_object(User, id=user)
|
||||
elif isinstance(user, str):
|
||||
user = get_object(User, username=user)
|
||||
elif isinstance(user, User):
|
||||
user = user
|
||||
else:
|
||||
user = None
|
||||
|
||||
|
||||
def refresh_group_api(user_group=None, asset_group=None):
|
||||
|
|
|
@ -7,6 +7,7 @@ urlpatterns = patterns('jperm.views',
|
|||
(r'^perm_user_edit/$', perm_user_edit),
|
||||
(r'^group/$', perm_group_list),
|
||||
(r'^perm_group_edit/$', perm_group_edit),
|
||||
(r'log/$', log),
|
||||
# (r'^dept_perm_edit/$', 'dept_perm_edit'),
|
||||
# (r'^perm_list/$', view_splitter, {'su': perm_list, 'adm': perm_list_adm}),
|
||||
# (r'^dept_perm_list/$', 'dept_perm_list'),
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -18,8 +18,8 @@ from django.http import HttpResponse, Http404
|
|||
from django.template import RequestContext
|
||||
from juser.models import User, UserGroup
|
||||
from jasset.models import Asset, AssetGroup
|
||||
from jlog.models import Log
|
||||
from jasset.models import AssetAlias
|
||||
from jlog.models import Log
|
||||
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.shortcuts import render_to_response
|
||||
|
|
|
@ -11,7 +11,9 @@ https://docs.djangoproject.com/en/1.7/ref/settings/
|
|||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
import os
|
||||
import ConfigParser
|
||||
import djcelery
|
||||
|
||||
djcelery.setup_loader()
|
||||
config = ConfigParser.ConfigParser()
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
||||
|
@ -43,7 +45,7 @@ TEMPLATE_DEBUG = True
|
|||
|
||||
ALLOWED_HOSTS = ['0.0.0.0/8']
|
||||
|
||||
|
||||
BROKER_URL = 'django://'
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = (
|
||||
|
@ -54,6 +56,8 @@ INSTALLED_APPS = (
|
|||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'django.contrib.humanize',
|
||||
'djcelery',
|
||||
'kombu.transport.django',
|
||||
'jumpserver',
|
||||
'juser',
|
||||
'jasset',
|
||||
|
|
|
@ -12,14 +12,6 @@ from jasset.models import AssetAlias
|
|||
register = template.Library()
|
||||
|
||||
|
||||
# @register.filter(name='stamp2str')
|
||||
# def stamp2str(value):
|
||||
# try:
|
||||
# return time.strftime('%Y/%m/%d %H:%M:%S', time.localtime(value))
|
||||
# except AttributeError:
|
||||
# return '0000/00/00 00:00:00'
|
||||
|
||||
|
||||
@register.filter(name='int2str')
|
||||
def int2str(value):
|
||||
"""
|
||||
|
@ -42,18 +34,6 @@ def get_role(user_id):
|
|||
return u"普通用户"
|
||||
|
||||
|
||||
# @register.filter(name='groups_str')
|
||||
# def groups_str(user_id):
|
||||
# groups = []
|
||||
# user = User.objects.get(id=user_id)
|
||||
# for group in user.group.all():
|
||||
# groups.append(group.name)
|
||||
# if len(groups) < 3:
|
||||
# return ' '.join(groups)
|
||||
# else:
|
||||
# return "%s ..." % ' '.join(groups[0:2])
|
||||
#
|
||||
|
||||
@register.filter(name='groups2str')
|
||||
def groups2str(group_list):
|
||||
"""
|
||||
|
@ -87,72 +67,6 @@ def user_asset_group_count(user):
|
|||
"""
|
||||
return len(user.asset_group.all())
|
||||
|
||||
#
|
||||
# @register.filter(name='user_group_asset_count')
|
||||
# def user_group_asset_count(user_group):
|
||||
# """
|
||||
# 返回用户组权限主机的数量
|
||||
# """
|
||||
# assets_id = user_group.assets.split(',')
|
||||
# asset_groups = user_group.asset_groups.split(',')
|
||||
#
|
||||
# for asset_group_id in asset_groups:
|
||||
# asset_group = get_object(AssetGroup, id=asset_group_id)
|
||||
# if asset_group:
|
||||
# assets_id.extend(asset.id for asset in asset_group.asset_set.all())
|
||||
#
|
||||
# assets_id = set(map(str, assets_id))
|
||||
# return len(assets_id)
|
||||
#
|
||||
#
|
||||
# @register.filter(name='user_group_asset_count')
|
||||
# def user_group_asset_group_count(user_group):
|
||||
# """
|
||||
# 返回用户组权限主机组的数量
|
||||
# """
|
||||
# return len(user_group.asset_groups.split(','))
|
||||
#
|
||||
# @register.filter(name='group_str2_all')
|
||||
# def group_str2_all(group_list):
|
||||
# group_lis = []
|
||||
# for i in group_list:
|
||||
# if str(i) != 'ALL':
|
||||
# group_lis.append(i)
|
||||
# if len(group_lis) < 3:
|
||||
# return ' '.join([group.name for group in group_lis])
|
||||
# else:
|
||||
# return '%s ...' % ' '.join([group.name for group in group_lis[0:2]])
|
||||
#
|
||||
#
|
||||
# @register.filter(name='group_dept_all')
|
||||
# def group_dept_all(group_list):
|
||||
# group_lis = []
|
||||
# for i in group_list:
|
||||
# if str(i) != 'ALL':
|
||||
# group_lis.append(i)
|
||||
# return ' '.join([group.name for group in group_lis])
|
||||
#
|
||||
#
|
||||
# @register.filter(name='group_manage_str')
|
||||
# def group_manage_str(username):
|
||||
# user = User.objects.get(username=username)
|
||||
# group = user.user_group.filter(type='M')
|
||||
# if group:
|
||||
# return group[0].name
|
||||
# else:
|
||||
# return ''
|
||||
#
|
||||
#
|
||||
# @register.filter(name='get_item')
|
||||
# def get_item(dictionary, key):
|
||||
# return dictionary.get(key)
|
||||
#
|
||||
#
|
||||
# @register.filter(name='get_login_type')
|
||||
# def get_login_type(login):
|
||||
# login_types = {'L': 'LDAP', 'M': 'MAP'}
|
||||
# return login_types[login]
|
||||
|
||||
|
||||
@register.filter(name='bool2str')
|
||||
def bool2str(value):
|
||||
|
@ -162,16 +76,6 @@ def bool2str(value):
|
|||
return u'否'
|
||||
|
||||
|
||||
# # @register.filter(name='user_readonly')
|
||||
# # def user_readonly(user_id):
|
||||
# # user = User.objects.filter(id=user_id)
|
||||
# # if user:
|
||||
# # user = user[0]
|
||||
# # if user.role == 'CU':
|
||||
# # return False
|
||||
# # return True
|
||||
|
||||
|
||||
@register.filter(name='members_count')
|
||||
def members_count(group_id):
|
||||
"""统计用户组下成员数量"""
|
||||
|
@ -181,148 +85,6 @@ def members_count(group_id):
|
|||
else:
|
||||
return 0
|
||||
|
||||
#
|
||||
# @register.filter(name='group_user_count')
|
||||
# def group_user_count(group_id):
|
||||
# group = UserGroup.objects.get(id=group_id)
|
||||
# return group.user_set.count()
|
||||
#
|
||||
#
|
||||
# @register.filter(name='dept_user_num')
|
||||
# def dept_user_num(dept_id):
|
||||
# dept = DEPT.objects.filter(id=dept_id)
|
||||
# if dept:
|
||||
# dept = dept[0]
|
||||
# return dept.user_set.count()
|
||||
# else:
|
||||
# return 0
|
||||
#
|
||||
#
|
||||
# @register.filter(name='dept_group_num')
|
||||
# def dept_group_num(dept_id):
|
||||
# dept = DEPT.objects.filter(id=dept_id)
|
||||
# if dept:
|
||||
# dept = dept[0]
|
||||
# return dept.usergroup_set.all().count()
|
||||
# else:
|
||||
# return 0
|
||||
#
|
||||
#
|
||||
# @register.filter(name='perm_count')
|
||||
# def perm_count(group_id):
|
||||
# group = UserGroup.objects.get(id=group_id)
|
||||
# return group.perm_set.count()
|
||||
#
|
||||
#
|
||||
# @register.filter(name='dept_asset_num')
|
||||
# def dept_asset_num(dept_id):
|
||||
# dept = DEPT.objects.filter(id=dept_id)
|
||||
# if dept:
|
||||
# dept = dept[0]
|
||||
# return dept.asset_set.all().count()
|
||||
# return 0
|
||||
#
|
||||
#
|
||||
# @register.filter(name='ugrp_perm_agrp_count')
|
||||
# def ugrp_perm_agrp_count(user_group_id):
|
||||
# user_group = UserGroup.objects.filter(id=user_group_id)
|
||||
# if user_group:
|
||||
# user_group = user_group[0]
|
||||
# return user_group.perm_set.all().count()
|
||||
# return 0
|
||||
#
|
||||
#
|
||||
# @register.filter(name='ugrp_sudo_agrp_count')
|
||||
# def ugrp_sudo_agrp_count(user_group_id):
|
||||
# user_group = UserGroup.objects.filter(id=user_group_id)
|
||||
# asset_groups = []
|
||||
# if user_group:
|
||||
# user_group = user_group[0]
|
||||
# for perm in user_group.sudoperm_set.all():
|
||||
# asset_groups.extend(perm.asset_group.all())
|
||||
# return len(set(asset_groups))
|
||||
# return 0
|
||||
#
|
||||
#
|
||||
# @register.filter(name='ugrp_perm_asset_count')
|
||||
# def ugrp_perm_asset_count(user_group_id):
|
||||
# user_group = UserGroup.objects.filter(id=user_group_id)
|
||||
# assets = []
|
||||
# if user_group:
|
||||
# user_group = user_group[0]
|
||||
# asset_groups = [perm.asset_group for perm in user_group.perm_set.all()]
|
||||
# for asset_group in asset_groups:
|
||||
# assets.extend(asset_group.asset_set.all())
|
||||
# return len(set(assets))
|
||||
#
|
||||
#
|
||||
# @register.filter(name='ugrp_sudo_asset_count')
|
||||
# def ugrp_sudo_asset_count(user_group_id):
|
||||
# user_group = UserGroup.objects.filter(id=user_group_id)
|
||||
# asset_groups = []
|
||||
# assets = []
|
||||
# if user_group:
|
||||
# user_group = user_group[0]
|
||||
# for perm in user_group.sudoperm_set.all():
|
||||
# asset_groups.extend(perm.asset_group.all())
|
||||
#
|
||||
# for asset_group in asset_groups:
|
||||
# assets.extend(asset_group.asset_set.all())
|
||||
# return len(set(assets))
|
||||
#
|
||||
#
|
||||
# @register.filter(name='get_user_alias')
|
||||
# def get_user_alias(post, user_id):
|
||||
# user = User.objects.get(id=user_id)
|
||||
# host = Asset.objects.get(id=post.id)
|
||||
# alias = AssetAlias.objects.filter(user=user, host=host)
|
||||
# if alias:
|
||||
# return alias[0].alias
|
||||
# else:
|
||||
# return ''
|
||||
#
|
||||
#
|
||||
# @register.filter(name='group_type_to_str')
|
||||
# def group_type_to_str(type_name):
|
||||
# group_types = {
|
||||
# 'P': '用户',
|
||||
# 'M': '部门',
|
||||
# 'A': '用户组',
|
||||
# }
|
||||
# return group_types.get(type_name)
|
||||
#
|
||||
#
|
||||
# @register.filter(name='ast_to_list')
|
||||
# def ast_to_list(lis):
|
||||
# ast_lis = ast.literal_eval(lis)
|
||||
# if len(ast_lis) <= 2:
|
||||
# return ','.join([i for i in ast_lis])
|
||||
# else:
|
||||
# restr = ','.join([i for i in ast_lis[0:2]]) + '...'
|
||||
# return restr
|
||||
#
|
||||
#
|
||||
# @register.filter(name='get_group_count')
|
||||
# def get_group_count(post, dept):
|
||||
# count = post.asset_set.filter(dept=dept).count()
|
||||
# return count
|
||||
#
|
||||
#
|
||||
# @register.filter(name='get_idc_count')
|
||||
# def get_idc_count(post, dept):
|
||||
# count = post.asset_set.filter(dept=dept).count()
|
||||
# return count
|
||||
#
|
||||
#
|
||||
# @register.filter(name='ast_to_list_1')
|
||||
# def ast_to_list_1(lis):
|
||||
# return ast.literal_eval(lis)
|
||||
#
|
||||
#
|
||||
# @register.filter(name='string_length')
|
||||
# def string_length(string, length):
|
||||
# return '%s ...' % string[0:length]
|
||||
|
||||
|
||||
@register.filter(name='to_name')
|
||||
def to_name(user_id):
|
||||
|
@ -336,17 +98,6 @@ def to_name(user_id):
|
|||
return '非法用户'
|
||||
|
||||
|
||||
# @register.filter(name='to_dept_name')
|
||||
# def to_dept_name(user_id):
|
||||
# try:
|
||||
# user = User.objects.filter(id=int(user_id))
|
||||
# if user:
|
||||
# user = user[0]
|
||||
# return user.dept.name
|
||||
# except:
|
||||
# return '非法部门'
|
||||
|
||||
|
||||
@register.filter(name='to_role_name')
|
||||
def to_role_name(role_id):
|
||||
"""role_id 转变为角色名称"""
|
||||
|
@ -359,99 +110,16 @@ def to_avatar(role_id='0'):
|
|||
"""不同角色不同头像"""
|
||||
role_dict = {'0': 'user', '1': 'admin', '2': 'root'}
|
||||
return role_dict.get(str(role_id), 'user')
|
||||
#
|
||||
#
|
||||
# @register.filter(name='get_user_asset_group')
|
||||
# def get_user_asset_group(user):
|
||||
# return user.get_asset_group()
|
||||
#
|
||||
#
|
||||
# @register.filter(name='group_asset_list')
|
||||
# def group_asset_list(group):
|
||||
# return group.asset_set.all()
|
||||
#
|
||||
#
|
||||
# @register.filter(name='group_asset_list_count')
|
||||
# def group_asset_list_count(group):
|
||||
# return group.asset_set.all().count()
|
||||
#
|
||||
#
|
||||
# @register.filter(name='time_delta')
|
||||
# def time_delta(time_before):
|
||||
# delta = datetime.datetime.now() - time_before
|
||||
# days = delta.days
|
||||
# if days:
|
||||
# return "%s 天前" % days
|
||||
# else:
|
||||
# hours = delta.seconds/3600
|
||||
# if hours:
|
||||
# return "%s 小时前" % hours
|
||||
# else:
|
||||
# mins = delta.seconds/60
|
||||
# if mins:
|
||||
# return '%s 分钟前' % mins
|
||||
# else:
|
||||
# return '%s 秒前' % delta.seconds
|
||||
#
|
||||
#
|
||||
# @register.filter(name='sudo_cmd_list')
|
||||
# def sudo_cmd_list(cmd_group_id):
|
||||
# cmd_group = CmdGroup.objects.filter(id=cmd_group_id)
|
||||
# if cmd_group:
|
||||
# cmd_group = cmd_group[0]
|
||||
# return cmd_group.cmd.split(',')
|
||||
#
|
||||
#
|
||||
# @register.filter(name='sudo_cmd_count')
|
||||
# def sudo_cmd_count(user_group_id):
|
||||
# user_group = UserGroup.objects.filter(id=user_group_id)
|
||||
# cmds = []
|
||||
# if user_group:
|
||||
# user_group = user_group[0]
|
||||
# cmd_groups = []
|
||||
#
|
||||
# for perm in user_group.sudoperm_set.all():
|
||||
# cmd_groups.extend(perm.cmd_group.all())
|
||||
#
|
||||
# for cmd_group in cmd_groups:
|
||||
# cmds.extend(cmd_group.cmd.split(','))
|
||||
# return len(set(cmds))
|
||||
#
|
||||
# else:
|
||||
# return 0
|
||||
#
|
||||
#
|
||||
# @register.filter(name='sudo_cmd_count')
|
||||
# def sudo_cmd_count(user_group_id):
|
||||
# user_group = UserGroup.objects.filter(id=user_group_id)
|
||||
# cmds = []
|
||||
# if user_group:
|
||||
# user_group = user_group[0]
|
||||
# cmd_groups = []
|
||||
# for perm in user_group.sudoperm_set.all():
|
||||
# cmd_groups.extend(perm.cmd_group.all())
|
||||
#
|
||||
# for cmd_group in cmd_groups:
|
||||
# cmds.extend(cmd_group.cmd.split(','))
|
||||
# return len(set(cmds))
|
||||
# else:
|
||||
# return 0
|
||||
#
|
||||
#
|
||||
# @register.filter(name='sudo_cmd_ids')
|
||||
# def sudo_cmd_ids(user_group_id):
|
||||
# user_group = UserGroup.objects.filter(id=user_group_id)
|
||||
# if user_group:
|
||||
# user_group = user_group[0]
|
||||
# cmd_groups = []
|
||||
# for perm in user_group.sudoperm_set.all():
|
||||
# cmd_groups.extend(perm.cmd_group.all())
|
||||
# cmd_ids = [str(cmd_group.id) for cmd_group in cmd_groups]
|
||||
# return ','.join(cmd_ids)
|
||||
# else:
|
||||
# return '0'
|
||||
#
|
||||
#
|
||||
# @register.filter(name='cmd_group_split')
|
||||
# def cmd_group_split(cmd_group):
|
||||
# return cmd_group.cmd.split(',')
|
||||
|
||||
|
||||
@register.filter(name='result2bool')
|
||||
def result2bool(result=''):
|
||||
"""将结果定向为结果"""
|
||||
result = eval(result)
|
||||
unreachable = result.get('unreachable', [])
|
||||
failures = result.get('failures', [])
|
||||
|
||||
if unreachable or failures:
|
||||
return '<b style="color: red">失败</b>'
|
||||
else:
|
||||
return '<b style="color: green">成功</b>'
|
||||
|
|
|
@ -1,179 +0,0 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load mytags %}
|
||||
{% block content %}
|
||||
{% include 'nav_cat_bar.html' %}
|
||||
<script type="text/javascript">
|
||||
function search_ip(text, noselect, total){
|
||||
$("#" + noselect).children().each(
|
||||
function(){
|
||||
$(this).remove();
|
||||
});
|
||||
|
||||
$("#" + total).children().each(function(){
|
||||
if($(this).text().search(text) != -1){
|
||||
$("#" + noselect).append($(this).clone())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="row">
|
||||
<div class="col-lg-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>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">未启用 1</a>
|
||||
</li>
|
||||
<li><a href="#">未启用 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<select id="assets_total" name="assets" class="form-control m-b" size="12" multiple style="display: none">
|
||||
{% for asset in assets %}
|
||||
<option value="{{ asset.id }}">{{ asset.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
<select id="asset_select_total" name="asset_select" class="form-control m-b" size="12" multiple style="display: none">
|
||||
{% for asset in asset_select %}
|
||||
<option value="{{ asset.id }}">{{ asset.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
<div class="ibox-content">
|
||||
<form id="sudoPerm" method="post" 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="row">
|
||||
<div class="form-group">
|
||||
<label for="group_name" class="col-sm-2 control-label">部门</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="dept_id" name="dept_id" type="text" class="form-control" value="{{ dept.id }}" style="display: none">
|
||||
<input id="dept_name" name="dept_name" type="text" class="form-control" value="{{ dept.name }}" readonly>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="group_name" class="col-sm-2 control-label">过滤</label>
|
||||
<div class="col-sm-4">
|
||||
<input id="noselect" class="form-control" oninput="search_ip(this.value, 'assets', 'assets_total')">
|
||||
</div>
|
||||
<div class="col-sm-1">
|
||||
</div>
|
||||
<div id="select" class="col-sm-3">
|
||||
<input class="form-control" oninput="search_ip(this.value, 'asset_select', 'asset_select_total')">
|
||||
</div>
|
||||
</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: 60px;">
|
||||
<button type="button" class="btn btn-white" onclick="move('assets', 'asset_select', 'assets_total', 'asset_select_total' )"><i class="fa fa-chevron-right"></i></button>
|
||||
<button type="button" class="btn btn-white" onclick="move('asset_select', 'assets', 'asset_select_total', 'assets_total')"><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_select %}
|
||||
<option value="{{ asset.id }}">{{ asset.ip }}</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">确认保存</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: "必须填写!"}
|
||||
},
|
||||
"user_groups_select": {
|
||||
rule: "required",
|
||||
tip: "选择用户组",
|
||||
ok: "",
|
||||
msg: {checked: "至少选择一个用户组"}
|
||||
},
|
||||
"asset_groups_select": {
|
||||
rule: "required",
|
||||
tip: "选择主机组",
|
||||
ok: "",
|
||||
msg: {checked: "至少选择一个主机组"}
|
||||
}
|
||||
|
||||
},
|
||||
valid: function(form) {
|
||||
form.submit();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
$("#submit_button").click(function(){
|
||||
$('#sudoPerm option').each(function(){
|
||||
$(this).prop('selected', true)
|
||||
})
|
||||
});
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
|
@ -1,104 +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-lg-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>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">未启用 1</a>
|
||||
</li>
|
||||
<li><a href="#">未启用 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ibox-content">
|
||||
<div class="">
|
||||
<a target="_blank" href="/juser/dept_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">
|
||||
Search
|
||||
</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 dept in contacts.object_list %}
|
||||
<tr class="gradeX">
|
||||
<td class="text-center"> {{ dept.name }} </td>
|
||||
<td class="text-center"><a href="/juser/user_list/?did={{ dept.id }}">{{ dept.id | dept_user_num }}</a> </td>
|
||||
<td class="text-center"><a href="/jasset/host_list/?did={{ dept.id }}">{{ dept.id | dept_asset_num }}</a> </td>
|
||||
<td class="text-center"> {{ dept.comment }} </td>
|
||||
<td class="text-center">
|
||||
{# <a title="[ {{ dept.name }} ] 成员信息" href="../dept_detail/?id={{ dept.id }}" class="iframe btn btn-xs btn-primary">主机</a>#}
|
||||
<a href="../dept_perm_edit/?id={{ dept.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 {{ contacts.start_index }} to {{ contacts.end_index }} of {{ p.count }} entries
|
||||
</div>
|
||||
</div>
|
||||
{% include 'paginator.html' %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$(".iframe").colorbox({iframe:true, width:"70%", height:"70%"});
|
||||
var check_array = []
|
||||
$('#del_btn').click(function(){
|
||||
$(".gradeX input:checked").each(function() {check_array.push($(this).attr("value")) })
|
||||
$(".gradeX input:checked").closest("tr").remove()
|
||||
$.post("/juser/dept_del_ajax/",
|
||||
{dept_ids: check_array.join(",")},
|
||||
function(data){
|
||||
alert(data)
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
|
@ -1,187 +0,0 @@
|
|||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
{% include 'nav_cat_bar.html' %}
|
||||
<script type="text/javascript">
|
||||
function search_ip(text, noselect, total){
|
||||
$("#" + noselect).children().each(
|
||||
function(){
|
||||
$(this).remove();
|
||||
});
|
||||
|
||||
$("#" + total).children().each(function(){
|
||||
if($(this).text().search(text) != -1){
|
||||
$("#" + noselect).append($(this).clone())
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="row">
|
||||
<div class="col-lg-10">
|
||||
<div id="add_asset" class="ibox float-e-margins">
|
||||
<div id="ibox-content" class="ibox-title">
|
||||
<h5> 填写要申请主机的基本信息 </h5>
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
</a>
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<select id="assets_total" name="assets" class="form-control m-b" size="12" multiple style="display: none">
|
||||
{% for asset in posts %}
|
||||
<option value="{{ asset.ip }}">{{ asset.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
<select id="asset_select_total" name="j_hosts" class="form-control m-b" size="12" multiple style="display: none">
|
||||
{% for asset in eposts %}
|
||||
<option value="{{ asset.ip }}">{{ asset.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
<div class="ibox-content">
|
||||
{% if emg %}
|
||||
<div class="alert alert-warning text-center">{{ emg }}</div>
|
||||
{% endif %}
|
||||
{% if smg %}
|
||||
<div class="alert alert-success text-center">{{ smg }}</div>
|
||||
{% endif %}
|
||||
<form id="assetForm" method="post" class="form-horizontal">
|
||||
{% csrf_token %}
|
||||
<div class="form-group"><label class="col-sm-2 control-label"> 申请人 <span class="red-fonts">*</span></label>
|
||||
<div class="col-sm-8"><input type="text" name="applyer" value="{{ name }}" class="form-control" readonly="readonly"></div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group"><label class="col-sm-2 control-label"> 所在部门 <span class="red-fonts">*</span></label>
|
||||
<div class="col-sm-8"><input type="text" name="dept" value="{{ deptname }}" class="form-control" readonly="readonly"></div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group" id="j_da"><label class="col-sm-2 control-label"> 管理员 <span class="red-fonts">*</span></label>
|
||||
<div class="radio">
|
||||
<label><input type="radio" value="{{ admin.id }}" name="da"> {{ admin.name }}</label>
|
||||
{% for da in dept_da %}
|
||||
<label><input type="radio" value="{{ da.id }}" name="da"> {{ da.name }}</label>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<label for="group" class="col-lg-2 control-label">主机组</label>
|
||||
<div class="col-sm-8">
|
||||
<select id="group" name="group" class="form-control m-b" multiple size="10">
|
||||
{% for g in egroup %}
|
||||
<option type="checkbox" value="{{ g.name }}">{{ g.name }} {% if g.comment %} --- {{ g.comment }} {% endif %}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<label for="group_name" class="col-sm-2 control-label">过滤</label>
|
||||
<div class="col-sm-4">
|
||||
<input id="noselect" class="form-control" oninput="search_ip(this.value, 'assets', 'assets_total')">
|
||||
</div>
|
||||
<div class="col-sm-1">
|
||||
</div>
|
||||
<div id="select" class="col-sm-3">
|
||||
<input class="form-control" oninput="search_ip(this.value, 'asset_select', 'asset_select_total')">
|
||||
</div>
|
||||
</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 post in posts %}
|
||||
<option value="{{ post.ip }}">{{ post.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-1">
|
||||
<div class="btn-group" style="margin-top: 60px;">
|
||||
<button type="button" class="btn btn-white" onclick="move('assets', 'asset_select', 'assets_total', 'asset_select_total' )"><i class="fa fa-chevron-right"></i></button>
|
||||
<button type="button" class="btn btn-white" onclick="move_left('asset_select', 'assets', 'asset_select_total', 'assets_total')"><i class="fa fa-chevron-left"></i> </button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<div>
|
||||
<select id="asset_select" name="hosts" class="form-control m-b" size="12" multiple></select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group"><label class="col-sm-2 control-label"> 申请说明 </label>
|
||||
<div class="col-sm-8"><textarea type="text" placeholder="" name="comment" class="form-control" rows="5" cols="20"></textarea></div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-5">
|
||||
<button class="btn btn-primary" id="submit_button" type="submit"> 提交 </button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#submit_button").click(function(){
|
||||
$('#assetForm option').each(function(){
|
||||
$(this).prop('selected', true)
|
||||
})
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
$('#assetForm').validator({
|
||||
timely: 2,
|
||||
theme: "yellow_right_effect",
|
||||
fields: {
|
||||
"j_da": {
|
||||
rule: "required",
|
||||
tip: "选择管理员",
|
||||
ok: "",
|
||||
msg: {required: "管理员必须选择!"},
|
||||
data: {'data-ok':"ok"}
|
||||
}
|
||||
},
|
||||
valid: function(form) {
|
||||
form.submit();
|
||||
}
|
||||
});
|
||||
|
||||
var $rows = $('#groups option');
|
||||
$('#search').keyup(function() {
|
||||
var val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase();
|
||||
|
||||
$rows.show().filter(function() {
|
||||
var text = $(this).text().replace(/\s+/g, ' ').toLowerCase();
|
||||
return !~text.indexOf(val);
|
||||
}).hide();
|
||||
});
|
||||
</script>
|
||||
{% endblock content %}
|
|
@ -1,31 +0,0 @@
|
|||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
{% include 'nav_cat_bar.html' %}
|
||||
<!--<h3 class="text-center">项目发布申请</h3>-->
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="row">
|
||||
<div class="col-lg-10">
|
||||
<div id="add_asset" class="ibox float-e-margins">
|
||||
<div class="ibox-content">
|
||||
<h2 id="jumpTo" class="text-center text-info"></h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function countDown(secs,surl){
|
||||
var jumpTo = document.getElementById('jumpTo');
|
||||
jumpTo.innerHTML='{{ smg }}......' + secs + '秒';
|
||||
if(--secs>0){
|
||||
setTimeout("countDown("+secs+",'"+surl+"')",1000);
|
||||
}
|
||||
else{
|
||||
location.href=surl;
|
||||
}
|
||||
}
|
||||
countDown(10,'/');
|
||||
</script>
|
||||
|
||||
{% endblock content %}
|
|
@ -1,55 +0,0 @@
|
|||
{% load mytags %}
|
||||
<html>
|
||||
<head>
|
||||
<link href="/static/css/bootstrap.min.css" rel="stylesheet">
|
||||
<script src="/static/js/jquery-2.1.1.js"></script>
|
||||
<script src="/static/js/bootstrap.min.js"></script>
|
||||
<!--<link href="/static/css/style.css" rel="stylesheet">
|
||||
<!--{% include 'head_script.html' %}
|
||||
|
||||
<!--<style type="text/css">-->
|
||||
<!--body-->
|
||||
<!--{-->
|
||||
<!--background: #FFFFFF;-->
|
||||
<!--}-->
|
||||
<!--</style>-->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<h3 class="text-center"><span class="text-success">{{ post.applyer }}</span>权限申请详情</h3>
|
||||
<br/>
|
||||
<div class="row">
|
||||
<div class="col-xs-5">
|
||||
<h6 class="text-right">申请人</h6>
|
||||
<h6 class="text-right">所属部门</h6>
|
||||
<h6 class="text-right">申请主机组</h6>
|
||||
<h6 class="text-right">申请主机</h6>
|
||||
{% for i in post.asset|ast_to_list_1 %}
|
||||
<h6 class="text-right" style="color: #ffffff">Null</h6>
|
||||
{% endfor %}
|
||||
<h6 class="text-right">批准人</h6>
|
||||
<h6 class="text-right">申请时间</h6>
|
||||
<h6 class="text-right">批准时间</h6>
|
||||
<h6 class="text-right">备注</h6>
|
||||
</div>
|
||||
<div class="col-xs-2">
|
||||
<div class="col-sm-offset-6" style="width: 2; height: 70%; background-color: #1AB394; padding-top: 200px"></div>
|
||||
</div>
|
||||
<div class="col-xs-5">
|
||||
<h6 class="text-left">{{ post.applyer }}</h6>
|
||||
<h6 class="text-left">{{ post.dept }}</h6>
|
||||
<h6 class="text-left">{% for i in post.bisgroup|ast_to_list_1 %} {{ i }} {% endfor %}</h6>
|
||||
{% for i in post.asset|ast_to_list_1 %}
|
||||
<h6 class="text-left">{{ i }}</h6>
|
||||
{% endfor %}
|
||||
<h6 class="text-right" style="color: #ffffff">Null</h6>
|
||||
<h6 class="text-left">{{ post.approver }}1</h6>
|
||||
<h6 class="text-left">{{ post.date_add|date:"Y-m-d H:i:s"}}</h6>
|
||||
<h6 class="text-left"> {{ post.date_end|date:"Y-m-d H:i:s" }}1 </h6>
|
||||
<h6 class="text-left"> {{ post.comment }} </h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,40 +0,0 @@
|
|||
{% load mytags %}
|
||||
<div class="tab-content">
|
||||
<table class="table table-striped table-bordered table-hover ">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center"> 申请人 </th>
|
||||
<th class="text-center"> 所属部门 </th>
|
||||
<th class="text-center"> 申请主机组 </th>
|
||||
<th class="text-center"> 申请主机 </th>
|
||||
<th class="text-center"> 批准人 </th>
|
||||
<th class="text-center"> 申请时间 </th>
|
||||
<th class="text-center"> 备注 </th>
|
||||
<th class="text-center"> 详情 </th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for post in contacts.object_list %}
|
||||
<tr class="gradeX">
|
||||
<td class="text-center" id="username"> {{ post.applyer }} </td>
|
||||
<td class="text-center" id="dept"> {{ post.dept }} </td>
|
||||
<td class="text-center" id="ip"> {{ post.bisgroup|ast_to_list }} </td>
|
||||
<td class="text-center" id="remote_ip"> {{ post.asset|ast_to_list }} </td>
|
||||
<td class="text-center" id="approver"> {{ post.approver }} </td>
|
||||
<td class="text-center" id="start_time"> {{ post.date_add|date:"Y-m-d H:i:s"}} </td>
|
||||
<td class="text-center" id=""> {{ post.comment }} </td>
|
||||
<td class="text-center" data-editable='false'>
|
||||
<a value="/jperm/apply_info/?uuid={{ post.uuid }}" class="iframe btn btn-xs btn-primary">详情</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
</div>
|
||||
{% include 'paginator.html' %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,61 +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-lg-6">
|
||||
<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>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">未启用 1</a>
|
||||
</li>
|
||||
<li><a href="#">未启用 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>IP</th>
|
||||
<th>IDC</th>
|
||||
<th>主机组</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for asset in assets_list %}
|
||||
<tr>
|
||||
<td>{{ asset.ip }}</td>
|
||||
<td>{{ asset.idc.name }}</td>
|
||||
<td>
|
||||
{% for group in asset.bis_group.all|filter_private %}
|
||||
{{ group }}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
|
@ -1,118 +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-lg-4">
|
||||
<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>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">Config option 1</a>
|
||||
</li>
|
||||
<li><a href="#">Config option 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content ibox-heading">
|
||||
<h3>用户</h3>
|
||||
<small><i class="fa fa-map-marker"></i> 组下用户.</small>
|
||||
</div>
|
||||
<div class="ibox-content inspinia-timeline">
|
||||
<div class="timeline-item">
|
||||
<div class="row">
|
||||
<div class="col-xs-3 date">
|
||||
<i class="fa fa-users"></i>
|
||||
<b>{{ user_group.name }}</b>
|
||||
<br>
|
||||
<small class="text-navy">共: {{ group_user_num }} 用户</small>
|
||||
</div>
|
||||
<div class="col-xs-7 content no-top-border">
|
||||
<p class="m-b-xs"><strong>{{ user_group.comment }}</strong></p>
|
||||
<p>
|
||||
{% for user in users %}
|
||||
{{ user.name }}<br>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if not user|get_user_asset_group %}
|
||||
(无)
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4">
|
||||
<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>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">Config option 1</a>
|
||||
</li>
|
||||
<li><a href="#">Config option 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content ibox-heading">
|
||||
<h3>授权主机/组</h3>
|
||||
<small><i class="fa fa-map-marker"></i> 这里包含了用户所有的主机组和组下的主机.</small>
|
||||
</div>
|
||||
<div class="ibox-content inspinia-timeline">
|
||||
{% for group in asset_groups %}
|
||||
<div class="timeline-item">
|
||||
<div class="row">
|
||||
<div class="col-xs-3 date">
|
||||
<i class="fa fa-repeat"></i>
|
||||
<b>{{ group.name }}</b>
|
||||
<br>
|
||||
<small class="text-navy">共: {{ group | group_asset_list_count }}台</small>
|
||||
</div>
|
||||
<div class="col-xs-7 content no-top-border">
|
||||
<p class="m-b-xs"><strong>{{ group.comment }}</strong></p>
|
||||
<p>
|
||||
{% for asset in group|group_asset_list %}
|
||||
{{ asset.ip }}<br>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if not user|get_user_asset_group %}
|
||||
(暂无)
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
|
@ -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-lg-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>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">未启用 1</a>
|
||||
</li>
|
||||
<li><a href="#">未启用 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ibox-content">
|
||||
<form id="sudoPerm" method="post" 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="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_id" name="user_group_id"type="text" value="{{ user_group.id }}" style="display: none">
|
||||
<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="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_groups_select %}
|
||||
<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="checkAll('userForm')">确认保存</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 %}
|
|
@ -1,138 +0,0 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load mytags %}
|
||||
|
||||
{% block content %}
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
function search_host(text){
|
||||
$("#asset_group_unperm").children().each(function(){$(this).remove();});
|
||||
var permArray = [];
|
||||
$("#asset_group_permed").children().each(function(){
|
||||
permArray.push($(this).text());
|
||||
});
|
||||
$("#asset_groups").children().each(function(){
|
||||
if ($(this).text().search(text) != -1 && permArray.indexOf($(this).text()) == -1) {
|
||||
$("#asset_group_unperm").append($(this).clone())
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
{% include 'nav_cat_bar.html' %}
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="row">
|
||||
<div class="col-lg-10">
|
||||
<div class="ibox float-e-margins">
|
||||
<!-- title -->
|
||||
<div class="ibox-title">
|
||||
<h5>授权编辑表单 <small>Edit perm of Group</small></h5>
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
</a>
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">Config option 1</a>
|
||||
</li>
|
||||
<li><a href="#">Config option 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end title -->
|
||||
<div class="ibox-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-5 ">
|
||||
<div class="form-group">
|
||||
<label></label>
|
||||
<input type="text" id="group_filter" placeholder="Search" class="form-control" value="" oninput="search_host(this.value)">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-1 ">
|
||||
<div class="form-group">
|
||||
<label></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-5 ">
|
||||
<div class="form-group">
|
||||
<label></label>
|
||||
<input type="text" class="form-control" value="{{ user_group.name }}" readonly>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<form method="post" action="">
|
||||
<input type="text" name="user_group_name" class="form-control" value="{{ user_group.name }}" style="display: none">
|
||||
<div class="row">
|
||||
<div class="col-sm-5"><h4>未授权主机组</h4>
|
||||
<div>
|
||||
<select id="asset_groups" name="asset_groups" class="form-control" size="10" multiple style="display: none">
|
||||
{% for asset_group in asset_groups %}
|
||||
<option value="{{ asset_group.id }}">{{ asset_group.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<select id="asset_group_unperm" name="asset_group_unperm" class="form-control m-b" size="12" multiple>
|
||||
{% for asset_group in asset_groups_unperm %}
|
||||
<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: 50px;">
|
||||
<button type="button" class="btn btn-white" onclick="move('asset_group_unperm', 'asset_group_permed')"><i class="fa fa-chevron-right"></i></button>
|
||||
<button type="button" class="btn btn-white" onclick="move('asset_group_permed', 'asset_group_unperm')"><i class="fa fa-chevron-left"></i> </button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-5"><h4>授权主机</h4>
|
||||
<div>
|
||||
<select id="asset_group_permed" name="asset_group_permed" class="form-control m-b" size="12" multiple>
|
||||
{% for asset_group in asset_groups_permed %}
|
||||
<option value="{{ asset_group.id }}">{{ asset_group.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</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="submit">取消</button>
|
||||
<button class="btn btn-primary" type="submit" onclick="javascript: (function(){$('#asset_group_permed option').each(function(){$(this).prop('selected', true)})})()">确认保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var str = document.location.pathname.split("/")[1];
|
||||
var str1 = document.location.pathname.split("/")[2];
|
||||
$("#"+str).addClass('active');
|
||||
$("#"+str1).addClass('active');
|
||||
</script>
|
||||
{# <script type="text/javascript">#}
|
||||
{# $("#asset_group_permed").children().each(function(){#}
|
||||
{# $("#asset_groups").append($(this).clone());#}
|
||||
{##}
|
||||
{# if ($(this).prop("selected") == false) {#}
|
||||
{# $("#asset_group_unperm").append(this);#}
|
||||
{# }#}
|
||||
{##}
|
||||
{# $("#asset_groups").children().each(function(){$(this).prop("selected", false)});#}
|
||||
{# });#}
|
||||
{# </script>#}
|
||||
|
||||
{% endblock %}
|
|
@ -1,132 +0,0 @@
|
|||
{% load mytags %}
|
||||
{% ifequal tab 'tab1' %}
|
||||
<table class="table table-striped table-bordered table-hover " id="editable" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">组名</th>
|
||||
<th class="text-center">
|
||||
<span class="text-muted text-xs block">类型</span>
|
||||
</th>
|
||||
<th class="text-center">成员数量</th>
|
||||
<th class="text-center">授权数量</th>
|
||||
<th class="text-center">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="perm_edit">
|
||||
{% for group in contacts.object_list %}
|
||||
<tr class="gradeX">
|
||||
<td class="text-center"> {{ group.name }} </td>
|
||||
<td class="text-center"> {{ group.type|group_type_to_str }} </td>
|
||||
<td class="text-center"> {{ group.id|member_count }} </td>
|
||||
<td class="text-center"> {{ group.id|perm_count }} </td>
|
||||
<td class="text-center">
|
||||
<a title="[ {{ group.name }} ] 授权详情" href="../perm_detail/?id={{ group.id }}" class="iframe btn btn-xs btn-primary">详情</a>
|
||||
<a href="../perm_edit/?id={{ group.id }}" class="btn btn-xs btn-info">编辑</a>
|
||||
<a href="../perm_del/?id={{ 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 {{ contacts.start_index }} to {{ contacts.end_index }} of {{ p.count }} entries
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="dataTables_paginate paging_simple_numbers" id="editable_paginate">
|
||||
<ul class="pagination" style="margin-top: 0; float: right">
|
||||
{% if contacts.has_previous %}
|
||||
<li class="paginate_button previous" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="?page={{ contacts.previous_page_number }}">Previous</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button previous disabled" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="#">Previous</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% for page in p.page_range %}
|
||||
{% ifequal offset1 page %}
|
||||
<li class="paginate_button active" aria-controls="editable" tabindex="0"><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% else %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% endifequal %}
|
||||
{% endfor %}
|
||||
{% if contacts.has_next %}
|
||||
<li class="paginate_button next" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="?page={{ contacts.next_page_number }}">Next</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button next disabled" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="#">Next</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<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 id="perm_list">
|
||||
{% for user in contacts2.object_list %}
|
||||
<tr class="gradeX">
|
||||
<td class="text-center"> {{ user.name }} </td>
|
||||
<td class="text-center"> {{ user.id | get_role }} </td>
|
||||
<td class="text-center"> {{ user.username | groups_str }} </td>
|
||||
<td class="text-center"> {{ user.id | perm_asset_count }} </td>
|
||||
<td class="text-center">
|
||||
<a title="{{ user.name }} ] 授权详情" href="../perm_asset_detail/?id={{ user.id }}" class="iframe btn btn-xs btn-primary">详情</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 {{ contacts2.start_index }} to {{ contacts2.end_index }} of {{ p2.count }} entries
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="dataTables_paginate paging_simple_numbers" id="editable_paginate">
|
||||
<ul class="pagination" style="margin-top: 0; float: right">
|
||||
{% if contacts2.has_previous %}
|
||||
<li class="paginate_button previous" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="?page={{ contacts2.previous_page_number }}">Previous</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button previous disabled" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="#">Previous</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% for page in p2.page_range %}
|
||||
{% ifequal offset1 page %}
|
||||
<li class="paginate_button active" aria-controls="editable" tabindex="0"><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% else %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% endifequal %}
|
||||
{% endfor %}
|
||||
{% if contacts2.has_next %}
|
||||
<li class="paginate_button next" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="?page={{ contacts2.next_page_number }}">Next</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button next disabled" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="#">Next</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endifequal %}
|
|
@ -1,12 +1,14 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load mytags %}
|
||||
{% block content %}
|
||||
{% include 'nav_cat_bar.html' %}
|
||||
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="col-lg-10">
|
||||
<div class="ibox float-e-margins">
|
||||
<div id="ibox-content" class="ibox-title">
|
||||
<h5> 用户权限申请详细信息列表 </h5>
|
||||
<div class="ibox-title">
|
||||
<h5> 查看小组</h5>
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
|
@ -14,12 +16,6 @@
|
|||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">未启用 1</a>
|
||||
</li>
|
||||
<li><a href="#">未启用 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
|
@ -27,63 +23,47 @@
|
|||
</div>
|
||||
|
||||
<div class="ibox-content">
|
||||
<div class="panel-options">
|
||||
<ul class="nav nav-tabs">
|
||||
<li><a href="/jperm/apply/online/" class="text-center"><i class="fa fa-laptop"></i> 未审批 </a></li>
|
||||
<li class="active"><a href="/jperm/apply/offline/" class="text-center"><i class="fa fa-bar-chart-o"></i> 已审批 </a></li>
|
||||
<li style="float: right">
|
||||
<form id="search_form" method="get" action="" class="pull-right mail-search">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control input-sm" id="search_input" name="keyword" placeholder="Search">
|
||||
<input type="text" style="display: none">
|
||||
<div class="input-group-btn">
|
||||
<button id='search_btn' type="button" class="btn btn-sm btn-primary" onclick="log_search()">
|
||||
Search
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="tab-content">
|
||||
<table class="table table-striped table-bordered table-hover ">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center"> 申请人 </th>
|
||||
<th class="text-center"> 所属部门 </th>
|
||||
<th class="text-center"> 申请主机组 </th>
|
||||
<th class="text-center"> 申请主机 </th>
|
||||
<th class="text-center"> 申请时间 </th>
|
||||
<th class="text-center"> 批准时间 </th>
|
||||
<th class="text-center"> 备注 </th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for post in contacts.object_list %}
|
||||
<tr class="gradeX">
|
||||
<td class="text-center" id="username"> {{ post.applyer }} </td>
|
||||
<td class="text-center" id="dept"> {{ post.dept }} </td>
|
||||
<td class="text-center" id="ip"> {{ post.bisgroup }} </td>
|
||||
<td class="text-center" id="remote_ip"> {{ post.asset }} </td>
|
||||
<!--{% ifnotequal session_role_id 0 %}-->
|
||||
<!--<td class="text-center"><a href="/jlog/history/?id={{ post.id }}" class="log_command"> 命令统计 </td>-->
|
||||
<!--{% endifnotequal %}-->
|
||||
<td class="text-center" id="start_time"> {{ post.date_add|date:"Y-m-d H:i:s"}} </td>
|
||||
<td class="text-center" id="end_time"> {{ post.date_end|date:"Y-m-d H:i:s" }} </td>
|
||||
<td class="text-center" id=""> {{ post.comment }} </td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="">
|
||||
<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>
|
||||
{% include 'paginator.html' %}
|
||||
</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>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for log in logs %}
|
||||
<tr class="gradeX">
|
||||
<td class="text-center"> {{ log.datetime | date:"Y-n-d G:i:s" }} </td>
|
||||
<td class="text-center">
|
||||
{{ log.result | result2bool | safe }}
|
||||
</td>
|
||||
<td class="text-center"> {{ log.is_finished | yesno:"是,否,为止" }} </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>
|
||||
|
|
|
@ -1,127 +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-lg-12">
|
||||
<div class="ibox float-e-margins">
|
||||
<div id="ibox-content" class="ibox-title">
|
||||
<h5> 用户权限申请详细信息列表 </h5>
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
</a>
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">未启用 1</a>
|
||||
</li>
|
||||
<li><a href="#">未启用 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ibox-content">
|
||||
<div class="panel-options">
|
||||
<ul class="nav nav-tabs">
|
||||
<li><a href="/jperm/apply_show/online/" class="text-center"><i class="fa fa-laptop"></i> 未审批 </a></li>
|
||||
<li class="active"><a href="/jperm/apply_show/offline/" class="text-center"><i class="fa fa-bar-chart-o"></i> 已审批 </a></li>
|
||||
<li style="float: right">
|
||||
<form id="search_form" method="get" action="" class="pull-right mail-search">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control input-sm" id="search_input" name="keyword" placeholder="Search">
|
||||
<input type="text" style="display: none">
|
||||
<div class="input-group-btn">
|
||||
<button id='search_btn' type="button" class="btn btn-sm btn-primary" onclick="apply_search()">
|
||||
Search
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="tab-content">
|
||||
<table class="table table-striped table-bordered table-hover ">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center"> 申请人 </th>
|
||||
<th class="text-center"> 所属部门 </th>
|
||||
<th class="text-center"> 申请主机组 </th>
|
||||
<th class="text-center"> 申请主机 </th>
|
||||
<th class="text-center"> 批准人 </th>
|
||||
<th class="text-center"> 申请时间 </th>
|
||||
<th class="text-center"> 备注 </th>
|
||||
<th class="text-center"> 详情 </th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for post in contacts.object_list %}
|
||||
<tr class="gradeX">
|
||||
<td class="text-center" id="username"> {{ post.applyer }} </td>
|
||||
<td class="text-center" id="dept"> {{ post.dept }} </td>
|
||||
<td class="text-center" id="ip"> {{ post.bisgroup|ast_to_list }} </td>
|
||||
<td class="text-center" id="remote_ip">{{ post.asset|ast_to_list }} </td>
|
||||
<td class="text-center" id="approver"> {{ post.approver }} </td>
|
||||
<td class="text-center" id="start_time"> {{ post.date_add|date:"Y-m-d H:i:s"}} </td>
|
||||
<td class="text-center" id=""> {{ post.comment }} </td>
|
||||
<td class="text-center" data-editable='false'>
|
||||
<a value="/jperm/apply_info/?uuid={{ post.uuid }}" class="iframe btn btn-xs btn-primary">详情</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
</div>
|
||||
{% include 'paginator.html' %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(".iframe").on('click', function(){
|
||||
var url= $(this).attr("value");
|
||||
$.layer({
|
||||
type: 2,
|
||||
title: '权限申请详情',
|
||||
maxmin: true,
|
||||
shift: 'top',
|
||||
border: [2, 0.3, '#1AB394'],
|
||||
shade: [0.5, '#000000'],
|
||||
shadeClose: true,
|
||||
area : ['800px' , '600px'],
|
||||
iframe: {src: url}
|
||||
});
|
||||
});
|
||||
function apply_search(){
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/jperm/apply_search/?env=offline",
|
||||
data: $("#search_form").serialize(),
|
||||
success: function (data) {
|
||||
$(".tab-content").html(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
$("#search_input").keydown(function(e){
|
||||
if(e.keyCode==13){
|
||||
apply_search()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
|
@ -1,128 +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-lg-12">
|
||||
<div class="ibox float-e-margins">
|
||||
<div id="ibox-content" class="ibox-title">
|
||||
<h5> 用户权限申请详细信息列表 </h5>
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
</a>
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">未启用 1</a>
|
||||
</li>
|
||||
<li><a href="#">未启用 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ibox-content">
|
||||
<div class="panel-options">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="/jperm/apply_show/online/" class="text-center"><i class="fa fa-laptop"></i> 未审批 </a></li>
|
||||
<li><a href="/jperm/apply_show/offline/" class="text-center"><i class="fa fa-bar-chart-o"></i> 已审批 </a></li>
|
||||
<li style="float: right">
|
||||
<form id="search_form" method="get" action="" class="pull-right mail-search">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control input-sm" id="search_input" name="keyword" placeholder="Search">
|
||||
<input type="text" style="display: none">
|
||||
<div class="input-group-btn">
|
||||
<button id='search_btn' type="button" class="btn btn-sm btn-primary" onclick="apply_search()">
|
||||
Search
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="tab-content">
|
||||
<table class="table table-striped table-bordered table-hover ">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center"> 申请人 </th>
|
||||
<th class="text-center"> 所属部门 </th>
|
||||
<th class="text-center"> 申请主机组 </th>
|
||||
<th class="text-center"> 申请主机 </th>
|
||||
<th class="text-center"> 申请时间 </th>
|
||||
<th class="text-center"> 备注 </th>
|
||||
<th class="text-center"> 操作 </th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for post in contacts.object_list %}
|
||||
<tr class="gradeX">
|
||||
<td class="text-center" id="username"> {{ post.applyer }} </td>
|
||||
<td class="text-center" id="dept"> {{ post.dept }} </td>
|
||||
<td class="text-center" id="ip"> {{ post.bisgroup|ast_to_list }}</td>
|
||||
<td class="text-center" id="remote_ip"> {{ post.asset|ast_to_list }} </td>
|
||||
<td class="text-center" id="start_time"> {{ post.date_add|date:"Y-m-d H:i:s"}} </td>
|
||||
<td class="text-center" id=""> {{ post.comment }} </td>
|
||||
<td class="text-center" data-editable='false'>
|
||||
<a value="/jperm/apply_info/?uuid={{ post.uuid }}" class="iframe btn btn-xs btn-primary">详情</a>
|
||||
{% ifnotequal session_role_id 0 %}
|
||||
<a href="/jperm/apply_exec/?uuid={{ post.uuid }}" class="btn btn-xs btn-info">确认</a>
|
||||
<a href="/jperm/apply_del/?uuid={{ post.uuid }}" class="btn btn-xs btn-danger">删除</a>
|
||||
{% endifnotequal %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
</div>
|
||||
{% include 'paginator.html' %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(".iframe").on('click', function(){
|
||||
var url= $(this).attr("value");
|
||||
$.layer({
|
||||
type: 2,
|
||||
title: '权限申请详情',
|
||||
maxmin: true,
|
||||
shift: 'top',
|
||||
border: [2, 0.3, '#1AB394'],
|
||||
shade: [0.5, '#000000'],
|
||||
shadeClose: true,
|
||||
area : ['800px' , '600px'],
|
||||
iframe: {src: url}
|
||||
});
|
||||
});
|
||||
function apply_search(){
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/jperm/apply_search/?env=online",
|
||||
data: $("#search_form").serialize(),
|
||||
success: function (data) {
|
||||
$(".tab-content").html(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
$("#search_input").keydown(function(e){
|
||||
if(e.keyCode==13){
|
||||
apply_search()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
|
@ -1,240 +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-lg-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>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">未启用 1</a>
|
||||
</li>
|
||||
<li><a href="#">未启用 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ibox-content">
|
||||
<div class="panel blank-panel">
|
||||
<div class="panel-heading">
|
||||
<div class="panel-options">
|
||||
<ul class="nav nav-tabs">
|
||||
<li id="tab1" class="active"><a data-toggle="tab" href="/perm_list/">授权查看</a></li>
|
||||
<li id="tab2" class=""><a data-toggle="tab" href="/perm_user_detail/">用户授权详情</a></li>
|
||||
<li style="float: right">
|
||||
<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="button" class="btn btn-sm btn-primary">
|
||||
Search
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
|
||||
<div class="tab-content">
|
||||
<div id="tab-1" class="tab-pane active">
|
||||
<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 id="perm_edit">
|
||||
{% for perm in contacts.object_list %}
|
||||
<tr class="gradeX">
|
||||
<td class="text-center"> {{ perm.name }} </td>
|
||||
<td class="text-center">
|
||||
{% for user_group in perm.user_group.all %}
|
||||
{{ user_group.name }}
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{% for asset_group in perm.asset_group.all %}
|
||||
{{ asset_group.name }}
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td class="text-center"> {{ perm.comment }} </td>
|
||||
<td class="text-center">
|
||||
<a title="[ {{ group.name }} 授权详情 ]" href="../perm_detail/?id={{ perm.id }}" class=" btn btn-xs btn-primary">详情</a>
|
||||
<a href="../perm_edit/?id={{ perm.id }}" class="btn btn-xs btn-info">编辑</a>
|
||||
<a href="../perm_del/?id={{ perm.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 {{ contacts.start_index }} to {{ contacts.end_index }} of {{ p.count }} entries
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="dataTables_paginate paging_simple_numbers" id="editable_paginate">
|
||||
<ul class="pagination" style="margin-top: 0; float: right">
|
||||
{% if contacts.has_previous %}
|
||||
<li class="paginate_button previous" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="?page={{ contacts.previous_page_number }}">Previous</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button previous disabled" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="#">Previous</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% for page in page_range %}
|
||||
{% ifequal current_page page %}
|
||||
<li class="paginate_button active" aria-controls="editable" tabindex="0"><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% else %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% endifequal %}
|
||||
{% endfor %}
|
||||
{% if contacts.has_next %}
|
||||
<li class="paginate_button next" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="?page={{ contacts.next_page_number }}">Next</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button next disabled" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="#">Next</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="tab-2" class="tab-pane">
|
||||
{# <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 id="perm_list">#}
|
||||
{# {% for user in contacts2.object_list %}#}
|
||||
{# <tr class="gradeX">#}
|
||||
{# <td class="text-center"> {{ user.name }} </td>#}
|
||||
{# <td class="text-center"> {{ user.id | get_role }} </td>#}
|
||||
{# <td class="text-center"> {{ user.username | groups_str }} </td>#}
|
||||
{# <td class="text-center"> {{ user.id | perm_asset_count }} </td>#}
|
||||
{# <td class="text-center">#}
|
||||
{# <a title="[ {{ user.name }} ] 授权详情" href="../perm_asset_detail/?id={{ user.id }}" class="btn btn-xs btn-primary">详情</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 {{ contacts2.start_index }} to {{ contacts2.end_index }} of {{ p2.count }} entries#}
|
||||
{# </div>#}
|
||||
{# </div>#}
|
||||
{# <div class="col-sm-6">#}
|
||||
{# <div class="dataTables_paginate paging_simple_numbers" id="editable_paginate">#}
|
||||
{# <ul class="pagination" style="margin-top: 0; float: right">#}
|
||||
{# {% if contacts2.has_previous %}#}
|
||||
{# <li class="paginate_button previous" aria-controls="editable" tabindex="0" id="editable_previous">#}
|
||||
{# <a href="?page={{ contacts2.previous_page_number }}">Previous</a>#}
|
||||
{# </li>#}
|
||||
{# {% else %}#}
|
||||
{# <li class="paginate_button previous disabled" aria-controls="editable" tabindex="0" id="editable_previous">#}
|
||||
{# <a href="#">Previous</a>#}
|
||||
{# </li>#}
|
||||
{# {% endif %}#}
|
||||
{# {% for page in page_range2 %}#}
|
||||
{# {% ifequal current_page page %}#}
|
||||
{# <li class="paginate_button active" aria-controls="editable" tabindex="0"><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>#}
|
||||
{# {% else %}#}
|
||||
{# <li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>#}
|
||||
{# {% endifequal %}#}
|
||||
{# {% endfor %}#}
|
||||
{# {% if contacts2.has_next %}#}
|
||||
{# <li class="paginate_button next" aria-controls="editable" tabindex="0" id="editable_next">#}
|
||||
{# <a href="?page={{ contacts2.next_page_number }}">Next</a>#}
|
||||
{# </li>#}
|
||||
{# {% else %}#}
|
||||
{# <li class="paginate_button next disabled" aria-controls="editable" tabindex="0" id="editable_next">#}
|
||||
{# <a href="#">Next</a>#}
|
||||
{# </li>#}
|
||||
{# {% endif %}#}
|
||||
{# </ul>#}
|
||||
{# </div>#}
|
||||
{# </div>#}
|
||||
{# </div>#}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$(".iframe").colorbox({iframe:true, width:"70%", height:"70%"});
|
||||
});
|
||||
|
||||
$(document).ready(function(){
|
||||
$('#search_btn').click(function(){
|
||||
if ($('#tab2').attr('class') == 'active'){
|
||||
var tab='tab2'
|
||||
} else {
|
||||
var tab='tab1'
|
||||
}
|
||||
|
||||
var search=$('#search_input').val()
|
||||
|
||||
$.post('/jperm/perm_list_ajax/',
|
||||
{'tab': tab, 'search': search},
|
||||
function(data){
|
||||
if ($('#tab2').attr('class') == 'active'){
|
||||
$('#tab-2').html(data)
|
||||
} else {
|
||||
$('#tab-1').html(data)
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
|
@ -1,226 +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-lg-10">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5> Sudo授权添加</h5>
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
</a>
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">未启用 1</a>
|
||||
</li>
|
||||
<li><a href="#">未启用 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel blank-panel">
|
||||
<div class="panel-heading">
|
||||
<div class="panel-options">
|
||||
<ul class="nav nav-tabs">
|
||||
<li id="tab1" class=""><a href="/jperm/sudo_list/">查看Sudo授权</a></li>
|
||||
<li id="tab2" class="active"><a href="/jperm/sudo_add/">Sudo授权添加</a></li>
|
||||
<li id="tab3" class=""><a href="/jperm/cmd_list/">查看命令组</a></li>
|
||||
<li id="tab4" class=""><a href="/jperm/cmd_add/">添加命令组</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
|
||||
<div class="tab-content">
|
||||
<div id="tab-1" class="tab-pane active">
|
||||
<form id="sudoPerm" method="post" 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="row">
|
||||
<div class="form-group">
|
||||
<label for="name" class="col-sm-2 control-label">授权名<span class="red-fonts">*</span></label>
|
||||
<div class="col-sm-8">
|
||||
<input id="name" name="name" placeholder="OnlyForEnglish" type="text" class="form-control">
|
||||
<span class="help-block m-b-none">取个名字方便辨识,只支持英文</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hr-line-dashed"></div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="runas" class="col-sm-2 control-label">RunAsUser<span class="red-fonts">*</span></label>
|
||||
<div class="col-sm-8">
|
||||
<input id="runas" name="runas" placeholder="RunAsUser" type="text" class="form-control">
|
||||
<span class="help-block m-b-none">
|
||||
允许以哪个用户允许sudo,逗号分隔,默认root
|
||||
</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="user_groups" name="user_groups" class="form-control" size="5" multiple>
|
||||
{% for user_group in user_groups %}
|
||||
<option value="{{ user_group.id }}">{{ user_group.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-sm-1">
|
||||
<div class="btn-group" style="margin-top: 12px;">
|
||||
<button type="button" class="btn btn-white" onclick="move('user_groups', 'user_groups_select')"><i class="fa fa-chevron-right"></i></button>
|
||||
<button type="button" class="btn btn-white" onclick="move('user_groups_select', 'user_groups')"><i class="fa fa-chevron-left"></i> </button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<div>
|
||||
<select id="user_groups_select" name="user_groups_select" class="form-control m-b" size="5" multiple>
|
||||
</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="5" 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: 12px;">
|
||||
<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="5" multiple>
|
||||
</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="cmd_groups" name="cmd_groups" class="form-control m-b" size="5" multiple>
|
||||
{% for cmd_group in cmd_groups %}
|
||||
<option value="{{ cmd_group.id }}">{{ cmd_group.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-1">
|
||||
<div class="btn-group" style="margin-top: 12px;">
|
||||
<button type="button" class="btn btn-white" onclick="move('cmd_groups', 'cmd_groups_select')"><i class="fa fa-chevron-right"></i></button>
|
||||
<button type="button" class="btn btn-white" onclick="move('cmd_groups_select', 'cmd_groups')"><i class="fa fa-chevron-left"></i> </button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<div>
|
||||
<select id="cmd_groups_select" name="cmd_groups_select" class="form-control m-b" size="5" multiple>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<label for="group_name" class="col-sm-2 control-label">备注</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="comment" name="comment" placeholder="备注说明" type="text" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="hr-line-dashed"></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">确认保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
$('#sudoPerm').validator({
|
||||
timely: 2,
|
||||
theme: "yellow_right_effect",
|
||||
fields: {
|
||||
"name": {
|
||||
rule: "required",
|
||||
tip: "输入授权名",
|
||||
ok: "",
|
||||
msg: {required: "必须填写!"}
|
||||
},
|
||||
"runas": {
|
||||
rule: "required",
|
||||
tip: "输入sudoas用户",
|
||||
ok: "",
|
||||
msg: {required: "必须填写!"}
|
||||
}
|
||||
|
||||
},
|
||||
valid: function(form) {
|
||||
form.submit();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
$("#submit_button").click(function(){
|
||||
$('#sudoPerm option').each(function(){
|
||||
$(this).prop('selected', true)
|
||||
})
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
|
@ -1,148 +0,0 @@
|
|||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
{% include 'nav_cat_bar.html' %}
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="row">
|
||||
<div class="col-lg-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>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">未启用 1</a>
|
||||
</li>
|
||||
<li><a href="#">未启用 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div class="panel blank-panel">
|
||||
<div class="panel-heading">
|
||||
<div class="panel-options">
|
||||
<ul class="nav nav-tabs">
|
||||
<li id="tab1" class=""><a href="/jperm/sudo_list/">查看Sudo授权</a></li>
|
||||
<li id="tab2" class=""><a href="/jperm/cmd_list/">查看命令组</a></li>
|
||||
<li id="tab3" class="active"><a href="/jperm/cmd_add/">添加命令组</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
|
||||
<div class="tab-content">
|
||||
<div id="tab-1" class="tab-pane active">
|
||||
<form id="cmdForm" method="post" 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="group_name" class="col-sm-2 control-label">组名<span class="red-fonts">*</span></label>
|
||||
<div class="col-sm-8">
|
||||
<input id="name" name="name" placeholder="Group name" type="text" class="form-control" value="{{ name }}" required="">
|
||||
<input id="cmd_group_id" name="cmd_group_id" type="text" class="form-control" value="{{ cmd_group_id }}" style="display: none">
|
||||
</div>
|
||||
</div>
|
||||
{% ifequal session_role_id 2 %}
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<label for="dept_id" class="col-sm-2 control-label">部门<span class="red-fonts">*</span></label>
|
||||
<div class="col-sm-8">
|
||||
<select id="dept_id" name="dept_id" class="form-control m-b">
|
||||
{% for dept in dept_all %}
|
||||
{% ifequal dept_id dept.id %}
|
||||
<option value="{{ dept.id }}" selected>{{ dept.name }}</option>
|
||||
{% else %}
|
||||
<option value="{{ dept.id }}">{{ dept.name }}</option>
|
||||
{% endifequal %}
|
||||
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{% endifequal %}
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<label for="group_type" class="col-sm-2 control-label">命令<span class="red-fonts">*</span></label>
|
||||
<div class="col-sm-8">
|
||||
<textarea id='cmd' name='cmd' class="form-control" rows="10" placeholder="/bin/su">{{ cmd }}</textarea>
|
||||
<span class="help-block m-b-none">
|
||||
输入命令一行一个,请写绝对路径如: /bin/su,所有是ALL,排除su是 !/bin/su
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<label for="group_name" class="col-sm-2 control-label">备注</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="comment" name="comment" placeholder="备注说明" type="text" class="form-control" value="{{ comment }}">
|
||||
</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>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$('#cmdForm').validator({
|
||||
timely: 2,
|
||||
theme: "yellow_right_effect",
|
||||
fields: {
|
||||
"name": {
|
||||
rule: "required",
|
||||
tip: "输入组名",
|
||||
ok: "",
|
||||
msg: {required: "必须填写!"}
|
||||
},
|
||||
"cmd": {
|
||||
rule: "required",
|
||||
tip: "输入组名",
|
||||
ok: "",
|
||||
msg: {required: "必须填写!"}
|
||||
}
|
||||
},
|
||||
valid: function(form) {
|
||||
form.submit();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
$("#submit_button").click(function(){
|
||||
$('#users_selected option').each(function(){
|
||||
$(this).prop('selected', true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
|
@ -1,48 +0,0 @@
|
|||
{% load mytags %}
|
||||
<html>
|
||||
<head>
|
||||
{% include 'link_css.html' %}
|
||||
|
||||
<style type="text/css">
|
||||
body
|
||||
{
|
||||
background: #FFFFFF;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="row">
|
||||
<div class="contact-box">
|
||||
{% if cmd_group_name %}
|
||||
<h2 class="text-center">{{ cmd_group.name }} 命令详情</h2>
|
||||
{% endif %}
|
||||
<div class="ibox-content">
|
||||
|
||||
<table class="table table-striped table-bordered table-hover " id="editable" >
|
||||
{% if cmd_group_name %}
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="text-center" width="120">ID</td>
|
||||
<td class="text-center">名称</td>
|
||||
<td class="text-center">部门</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="gradeX">
|
||||
<td class="text-center">{{ cmd_group.id }}</td>
|
||||
<td class="text-center">{{ cmd_group.name }}</td>
|
||||
<td class="text-center">{{ cmd_group.dept.name }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
<tr>
|
||||
<td colspan="1" class="text-center">命令:</td>
|
||||
<td colspan="6" class="text-center">
|
||||
<b>{{ cmds_str }}</b>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,140 +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-lg-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>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">未启用 1</a>
|
||||
</li>
|
||||
<li><a href="#">未启用 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ibox-content">
|
||||
<div class="panel blank-panel">
|
||||
<div class="panel-heading">
|
||||
<div class="panel-options">
|
||||
<ul class="nav nav-tabs">
|
||||
<li id="tab1" class=""><a href="/jperm/sudo_list/">查看Sudo授权</a></li>
|
||||
<li id="tab2" class="active"><a href="/jperm/cmd_list/">查看命令组</a></li>
|
||||
<li id="tab3" class=""><a href="/jperm/cmd_add/">添加命令组</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div class="tab-content">
|
||||
<div id="tab-1" class="tab-pane active">
|
||||
|
||||
<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 group in contacts.object_list %}
|
||||
<tr class="gradeX">
|
||||
<td class="text-center"> {{ group.name }} </td>
|
||||
<td class="text-center" title="{{ group.cmd }}"> {{ group.cmd | string_length:50 }} </td>
|
||||
<td class="text-center"> {{ group.dept.name }} </td>
|
||||
<td class="text-center"> {{ group.comment }} </td>
|
||||
<td class="text-center">
|
||||
<a value="../cmd_detail/?id={{ group.id }}" class="btn btn-xs btn-primary iframe">详情</a>
|
||||
<a href="../cmd_edit/?id={{ group.id }}" class="btn btn-xs btn-info">编辑</a>
|
||||
<a href="../cmd_del/?id={{ group.id }}" class="btn btn-xs btn-danger">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="dataTables_info" id="editable_info" role="status" aria-live="polite">
|
||||
Showing {{ contacts.start_index }} to {{ contacts.end_index }} of {{ p.count }} entries
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="dataTables_paginate paging_simple_numbers" id="editable_paginate">
|
||||
<ul class="pagination" style="margin-top: 0; float: right">
|
||||
{% if contacts.has_previous %}
|
||||
<li class="paginate_button previous" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="?page={{ contacts.previous_page_number }}">Previous</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button previous disabled" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="#">Previous</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% for page in p.page_range %}
|
||||
{% ifequal offset1 page %}
|
||||
<li class="paginate_button active" aria-controls="editable" tabindex="0"><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% else %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% endifequal %}
|
||||
{% endfor %}
|
||||
{% if contacts.has_next %}
|
||||
<li class="paginate_button next" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="?page={{ contacts.next_page_number }}">Next</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button next disabled" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="#">Next</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(".iframe").on('click', function () {
|
||||
var url = $(this).attr("value");
|
||||
$.layer({
|
||||
type: 2,
|
||||
title: '命令详情',
|
||||
maxmin: true,
|
||||
shift: 'top',
|
||||
border: [2, 0.3, '#1AB394'],
|
||||
shade: [0.5, '#000000'],
|
||||
shadeClose: true,
|
||||
area: ['800px', '600px'],
|
||||
iframe: {src: url}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
|
@ -1,170 +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-lg-4">
|
||||
<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>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">Config option 1</a>
|
||||
</li>
|
||||
<li><a href="#">Config option 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content ibox-heading">
|
||||
<h3>用户</h3>
|
||||
<small><i class="fa fa-map-marker"></i> 组下用户.</small>
|
||||
</div>
|
||||
<div class="ibox-content inspinia-timeline">
|
||||
<div class="timeline-item">
|
||||
<div class="row">
|
||||
<div class="col-xs-3 date">
|
||||
<i class="fa fa-users"></i>
|
||||
<b>{{ user_group.name }}</b>
|
||||
<br>
|
||||
<small class="text-navy">共: {{ group_user_num }} 用户</small>
|
||||
</div>
|
||||
<div class="col-xs-7 content no-top-border">
|
||||
<p class="m-b-xs"><strong>{{ user_group.comment }}</strong></p>
|
||||
<p>
|
||||
{% for user in users %}
|
||||
{{ user.name }}<br>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if not users %}
|
||||
(暂无)
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4">
|
||||
<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>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">Config option 1</a>
|
||||
</li>
|
||||
<li><a href="#">Config option 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content ibox-heading">
|
||||
<h3>授权主机/组</h3>
|
||||
<small><i class="fa fa-map-marker"></i> 这里包含了sudo授权所有的主机组和组下的主机.</small>
|
||||
</div>
|
||||
<div class="ibox-content inspinia-timeline">
|
||||
{% for group in asset_groups %}
|
||||
<div class="timeline-item">
|
||||
<div class="row">
|
||||
<div class="col-xs-3 date">
|
||||
<i class="fa fa-repeat"></i>
|
||||
<b>{{ group.name }}</b>
|
||||
<br>
|
||||
<small class="text-navy">共: {{ group | group_asset_list_count }}台</small>
|
||||
</div>
|
||||
<div class="col-xs-7 content no-top-border">
|
||||
<p class="m-b-xs"><strong>{{ group.comment }}</strong></p>
|
||||
<p>
|
||||
{% for asset in group|group_asset_list %}
|
||||
{{ asset.ip }}<br>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if not asset_groups %}
|
||||
(暂无)
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4">
|
||||
<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>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">Config option 1</a>
|
||||
</li>
|
||||
<li><a href="#">Config option 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content inspinia-timeline">
|
||||
{% for cmd_group in cmd_groups %}
|
||||
<div class="timeline-item">
|
||||
<div class="row">
|
||||
<div class="col-xs-3 date">
|
||||
<i class="fa fa-linux"></i>
|
||||
<b>{{ cmd_group.name }}</b>
|
||||
<br>
|
||||
<small class="text-navy">共: {{ cmd_group.id|sudo_cmd_count }} 个</small>
|
||||
</div>
|
||||
<div class="col-xs-7 content no-top-border">
|
||||
<p class="m-b-xs"><strong>{{ group.comment }}</strong></p>
|
||||
<p>
|
||||
{% for cmd in cmd_group|cmd_group_split %}
|
||||
{{ cmd }}<br>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if not cmd_groups %}
|
||||
(暂无)
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
|
@ -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-lg-10">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5> Sudo授权编辑 </h5>
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
</a>
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">未启用 1</a>
|
||||
</li>
|
||||
<li><a href="#">未启用 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ibox-content">
|
||||
<div class="panel blank-panel">
|
||||
<div class="panel-heading">
|
||||
<div class="panel-options">
|
||||
<ul class="nav nav-tabs">
|
||||
<li id="tab1" class="active"><a href="/jperm/sudo_list/">编辑Sudo授权</a></li>
|
||||
<li id="tab2" class=""><a href="/jperm/cmd_list/">查看命令组</a></li>
|
||||
<li id="tab3" class=""><a href="/jperm/cmd_add/">添加命令组</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<form id="sudoPerm" method="post" 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="row">
|
||||
<div class="form-group">
|
||||
<label for="runas" class="col-sm-2 control-label">RunAsUser<span class="red-fonts">*</span></label>
|
||||
<div class="col-sm-8">
|
||||
<input id="runas" name="runas" placeholder="RunAsUser" type="text" class="form-control" value="{{ user_runas }}">
|
||||
<input id="user_group_id" name="user_group_id" type="text" value="{{ user_group.id }}" style="display: none">
|
||||
<span class="help-block m-b-none">
|
||||
允许以哪个用户进行sudo,逗号分隔,如: root或者 ALL 等
|
||||
</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 m-b" size="10" 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: 12px;">
|
||||
<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="10" multiple>
|
||||
{% for asset_group in asset_group_permed %}
|
||||
<option value="{{ asset_group.id }}">{{ asset_group.name }}</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="cmd_groups" name="cmd_groups" class="form-control m-b" size="10" multiple>
|
||||
{% for cmd_group in cmd_groups %}
|
||||
<option value="{{ cmd_group.id }}">{{ cmd_group.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-1">
|
||||
<div class="btn-group" style="margin-top: 12px;">
|
||||
<button type="button" class="btn btn-white" onclick="move('cmd_groups', 'cmd_groups_select')"><i class="fa fa-chevron-right"></i></button>
|
||||
<button type="button" class="btn btn-white" onclick="move('cmd_groups_select', 'cmd_groups')"><i class="fa fa-chevron-left"></i> </button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<div>
|
||||
<select id="cmd_groups_select" name="cmd_groups_select" class="form-control m-b" size="10" multiple>
|
||||
{% for cmd_group in cmd_group_permed %}
|
||||
<option value="{{ cmd_group.id }}">{{ cmd_group.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<label for="group_name" class="col-sm-2 control-label">备注</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="comment" name="comment" placeholder="备注说明" type="text" class="form-control" value="{{ comment }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="hr-line-dashed"></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 class="btn btn-primary" type="submit" onclick="javascript: (function(){$('#sudoPerm option').each(function(){$(this).prop('selected', true)})})()">确认保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
@ -1,129 +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-lg-10">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5> Sudo授权列表 </h5>
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
</a>
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">未启用 1</a>
|
||||
</li>
|
||||
<li><a href="#">未启用 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ibox-content">
|
||||
|
||||
<div class="panel blank-panel">
|
||||
<div class="panel-heading">
|
||||
<div class="panel-options">
|
||||
<ul class="nav nav-tabs">
|
||||
<li id="tab1" class="active"><a href="/jperm/sudo_list/">查看Sudo授权</a></li>
|
||||
<li id="tab2" class=""><a href="/jperm/cmd_list/">查看命令组</a></li>
|
||||
<li id="tab3" class=""><a href="/jperm/cmd_add/">添加命令组</a></li>
|
||||
<button id="refresh" class="btn btn-primary btn-sm pull-right" style="margin-right: 20px;" data-toggle="tooltip" data-placement="left" title="" data-original-title="Refresh inbox">
|
||||
<i class="fa fa-refresh"></i> 刷新
|
||||
</button>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div class="tab-content">
|
||||
<div id="tab-1" class="tab-pane active">
|
||||
<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>
|
||||
<th class="text-center">sudo命令</th>
|
||||
<th class="text-center">备注</th>
|
||||
<th class="text-center">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for group in contacts.object_list %}
|
||||
<tr class="gradeX">
|
||||
<td class="text-center"> {{ group.name }} </td>
|
||||
<td class="text-center"> {{ group.dept.name }} </td>
|
||||
<td class="text-center"><a href="/juser/user_list/?gid={{ group.id }}">{{ group.id | member_count }} </a> </td>
|
||||
<td class="text-center"><a href="/jasset/group_list/?sid={{ group.id }}">{{ group.id | ugrp_sudo_agrp_count }} </a> </td>
|
||||
<td class="text-center"><a href="/jasset/host_list/?sid={{ group.id }}"> {{ group.id | ugrp_sudo_asset_count }} </a> </td>
|
||||
<td class="text-center"><a value="/jperm/cmd_detail/?id={{ group.id | sudo_cmd_ids }}" class="iframe">{{ group.id | sudo_cmd_count }}</a> </td>
|
||||
<td class="text-center"> {{ group.comment }} </td>
|
||||
<td class="text-center">
|
||||
<a href="../sudo_detail/?id={{ group.id }}" class="btn btn-xs btn-primary">详情</a>
|
||||
<a href="../sudo_edit/?id={{ group.id }}" class="btn btn-xs btn-danger">sudo授权</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 {{ contacts.start_index }} to {{ contacts.end_index }} of {{ p.count }} entries
|
||||
</div>
|
||||
</div>
|
||||
{% include 'paginator.html' %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$(".iframe").on('click', function(){
|
||||
var url= $(this).attr("value");
|
||||
$.layer({
|
||||
type: 2,
|
||||
title: '命令详情',
|
||||
maxmin: true,
|
||||
shift: 'top',
|
||||
border: [2, 0.3, '#1AB394'],
|
||||
shade: [0.5, '#000000'],
|
||||
shadeClose: true,
|
||||
area : ['800px' , '600px'],
|
||||
iframe: {src: url}
|
||||
});
|
||||
});
|
||||
$("#refresh").click(function(){
|
||||
$.get('/jperm/sudo_refresh/',
|
||||
{'test':''},
|
||||
function(data){
|
||||
alert(data)
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
|
@ -39,6 +39,7 @@
|
|||
<a href="/jperm/sudo_list/">命令授权</a>
|
||||
</li>
|
||||
<li class="apply_show online"><a href="/jperm/apply_show/online/">权限审批</a></li>
|
||||
<li class="apply_show online"><a href="/jperm/log/">授权记录</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li id="jlog">
|
||||
|
|
Loading…
Reference in New Issue