mirror of https://github.com/jumpserver/jumpserver
fix(user manage and connect first login)
When delete a user, but didn't delete the user sysuser key. When create a user with same username, error occur. When user login tty, and type a num first, it will search a host, but login the asset with the id. fixedpull/194/head
parent
d20fecadac
commit
1f09a40c77
|
@ -436,10 +436,10 @@ class Nav(object):
|
|||
"""
|
||||
def __init__(self, user):
|
||||
self.user = user
|
||||
self.search_result = None
|
||||
self.user_perm = get_group_user_perm(self.user)
|
||||
self.perm_assets = sorted(self.user_perm.get('asset', []).keys(),
|
||||
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', [])
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -181,6 +181,8 @@ def server_del_user(username):
|
|||
删除系统上的某用户
|
||||
"""
|
||||
bash('userdel -r -f %s' % username)
|
||||
print('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):
|
||||
|
|
|
@ -254,7 +254,7 @@ def user_del(request):
|
|||
user = get_object(User, id=user_id)
|
||||
if user and user.username != 'admin':
|
||||
logger.debug(u"删除用户 %s " % user.username)
|
||||
bash('userdel -r %s' % user.username)
|
||||
server_del_user(user.username)
|
||||
user.delete()
|
||||
return HttpResponse('删除成功')
|
||||
|
||||
|
|
Loading…
Reference in New Issue