mirror of https://github.com/jumpserver/jumpserver
Fix nav info and delete user key when delete a user
Fix nav info and delete user key when delete a user reviewd by ibuler <ibuler@qq.com>pull/204/head
commit
efe0b3acc0
|
@ -436,10 +436,10 @@ class Nav(object):
|
||||||
"""
|
"""
|
||||||
def __init__(self, user):
|
def __init__(self, user):
|
||||||
self.user = user
|
self.user = user
|
||||||
self.search_result = None
|
|
||||||
self.user_perm = get_group_user_perm(self.user)
|
self.user_perm = get_group_user_perm(self.user)
|
||||||
self.perm_assets = sorted(self.user_perm.get('asset', []).keys(),
|
self.perm_assets = sorted(self.user_perm.get('asset', []).keys(),
|
||||||
key=lambda x: [int(num) for num in x.ip.split('.') if num.isdigit()])
|
key=lambda x: [int(num) for num in x.ip.split('.') if num.isdigit()])
|
||||||
|
self.search_result = self.perm_assets
|
||||||
self.perm_asset_groups = self.user_perm.get('asset_group', [])
|
self.perm_asset_groups = self.user_perm.get('asset_group', [])
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -450,11 +450,11 @@ class Nav(object):
|
||||||
"""
|
"""
|
||||||
msg = """\n\033[1;32m### 欢迎使用Jumpserver开源跳板机系统 ### \033[0m
|
msg = """\n\033[1;32m### 欢迎使用Jumpserver开源跳板机系统 ### \033[0m
|
||||||
|
|
||||||
1) 输入 \033[32mID\033[0m 直接登录.
|
1) 输入 \033[32mID\033[0m 直接登录 或 输入\033[32m部分 IP,主机名,备注\033[0m 进行搜索登录(如果唯一).
|
||||||
2) 输入 \033[32m/\033[0m + \033[32mIP, 主机名 or 备注 \033[0m搜索.
|
2) 输入 \033[32m/\033[0m + \033[32mIP, 主机名 or 备注 \033[0m搜索. 如: /ip
|
||||||
3) 输入 \033[32mP/p\033[0m 显示您有权限的主机.
|
3) 输入 \033[32mP/p\033[0m 显示您有权限的主机.
|
||||||
4) 输入 \033[32mG/g\033[0m 显示您有权限的主机组.
|
4) 输入 \033[32mG/g\033[0m 显示您有权限的主机组.
|
||||||
5) 输入 \033[32mG/g\033[0m\033[0m + \033[32m组ID\033[0m 显示该组下主机.
|
5) 输入 \033[32mG/g\033[0m\033[0m + \033[32m组ID\033[0m 显示该组下主机. 如: g1
|
||||||
6) 输入 \033[32mE/e\033[0m 批量执行命令.
|
6) 输入 \033[32mE/e\033[0m 批量执行命令.
|
||||||
7) 输入 \033[32mU/u\033[0m 批量上传文件.
|
7) 输入 \033[32mU/u\033[0m 批量上传文件.
|
||||||
8) 输入 \033[32mD/d\033[0m 批量下载文件.
|
8) 输入 \033[32mD/d\033[0m 批量下载文件.
|
||||||
|
|
|
@ -181,6 +181,8 @@ def server_del_user(username):
|
||||||
删除系统上的某用户
|
删除系统上的某用户
|
||||||
"""
|
"""
|
||||||
bash('userdel -r -f %s' % username)
|
bash('userdel -r -f %s' % username)
|
||||||
|
logger.debug('rm -f %s/%s_*.pem' % (os.path.join(KEY_DIR, 'user'), username))
|
||||||
|
bash('rm -f %s/%s_*.pem' % (os.path.join(KEY_DIR, 'user'), username))
|
||||||
|
|
||||||
|
|
||||||
def get_display_msg(user, password='', ssh_key_pwd='', send_mail_need=False):
|
def get_display_msg(user, password='', ssh_key_pwd='', send_mail_need=False):
|
||||||
|
|
|
@ -254,7 +254,7 @@ def user_del(request):
|
||||||
user = get_object(User, id=user_id)
|
user = get_object(User, id=user_id)
|
||||||
if user and user.username != 'admin':
|
if user and user.username != 'admin':
|
||||||
logger.debug(u"删除用户 %s " % user.username)
|
logger.debug(u"删除用户 %s " % user.username)
|
||||||
bash('userdel -r %s' % user.username)
|
server_del_user(user.username)
|
||||||
user.delete()
|
user.delete()
|
||||||
return HttpResponse('删除成功')
|
return HttpResponse('删除成功')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue