From 2ea0d9aa06ba827aa5be8f58ee84cefb884583a5 Mon Sep 17 00:00:00 2001 From: Apex Liu Date: Fri, 20 Apr 2018 14:24:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=9A=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=AE=A1=E7=90=86=E7=95=8C=E9=9D=A2=EF=BC=8C=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E5=85=88=E7=BC=96=E8=BE=91=E4=B8=80=E4=B8=AA=E7=94=A8?= =?UTF-8?q?=E6=88=B7=EF=BC=88=E5=8D=B3=E4=BD=BF=E4=B8=8D=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=EF=BC=89=EF=BC=8C=E7=84=B6=E5=90=8E=E6=89=A7=E8=A1=8C=E6=96=B0?= =?UTF-8?q?=E5=BB=BA=E7=94=A8=E6=88=B7=EF=BC=8C=E5=88=99=E5=88=9A=E5=88=9A?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E7=9A=84=E7=94=A8=E6=88=B7=E7=9A=84=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E4=BC=9A=E8=A2=AB=E6=9B=BF=E6=8D=A2=E6=88=90=E6=96=B0?= =?UTF-8?q?=E5=BB=BA=E7=94=A8=E6=88=B7=E7=9A=84=E4=BF=A1=E6=81=AF=EF=BC=8C?= =?UTF-8?q?=E8=80=8C=E5=B9=B6=E6=B2=A1=E6=9C=89=E6=96=B0=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E8=A2=AB=E5=88=9B=E5=BB=BA=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/www/teleport/static/js/user/user-list.js | 1 + server/www/teleport/webroot/app/model/user.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/server/www/teleport/static/js/user/user-list.js b/server/www/teleport/static/js/user/user-list.js index dff2f34..65f0719 100644 --- a/server/www/teleport/static/js/user/user-list.js +++ b/server/www/teleport/static/js/user/user-list.js @@ -789,6 +789,7 @@ $app.create_dlg_edit_user = function () { if (_.isUndefined(user)) { dlg.dom.dlg_title.html('创建用户账号'); + dlg.field_id = -1; dlg.dom.edit_username.val(''); dlg.dom.edit_surname.val(''); diff --git a/server/www/teleport/webroot/app/model/user.py b/server/www/teleport/webroot/app/model/user.py index 5eb53f2..e725e91 100644 --- a/server/www/teleport/webroot/app/model/user.py +++ b/server/www/teleport/webroot/app/model/user.py @@ -267,7 +267,7 @@ def update_user(handler, args): db = get_db() # 1. 判断此账号是否已经存在 - sql = 'SELECT `username` FROM {dbtp}user WHERE id={dbph};'.format(dbtp=db.table_prefix, dbph=db.place_holder) + sql = 'SELECT `username` FROM {dbtp}user WHERE `id`={dbph};'.format(dbtp=db.table_prefix, dbph=db.place_holder) db_ret = db.query(sql, (args['id'], )) if db_ret is None or len(db_ret) == 0: return TPE_NOT_EXISTS @@ -275,7 +275,7 @@ def update_user(handler, args): old_username = db_ret[0][0] if old_username != args['username']: # 如果要更新用户登录名,则需要判断是否已经存在了 - sql = 'SELECT `id` FROM {dbtp}user WHERE username={dbph};'.format(dbtp=db.table_prefix, dbph=db.place_holder) + sql = 'SELECT `id` FROM {dbtp}user WHERE `username`={dbph};'.format(dbtp=db.table_prefix, dbph=db.place_holder) db_ret = db.query(sql, (args['username'],)) if db_ret is not None and len(db_ret) > 0: return TPE_EXISTS From 8f214f86b9205ef33662de57d81f6dd4e567eaaf Mon Sep 17 00:00:00 2001 From: Apex Liu Date: Sun, 22 Apr 2018 16:01:30 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=9A=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E4=B8=BB=E6=9C=BA=E4=BF=A1=E6=81=AF=E5=B9=B6=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=EF=BC=8C=E6=8F=90=E7=A4=BA=E6=88=90=E5=8A=9F=EF=BC=8C?= =?UTF-8?q?=E4=BD=86=E4=B8=BB=E6=9C=BA=E4=BF=A1=E6=81=AF=E5=B9=B6=E6=9C=AA?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/www/teleport/webroot/app/model/host.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/www/teleport/webroot/app/model/host.py b/server/www/teleport/webroot/app/model/host.py index 185e522..c9bfc70 100644 --- a/server/www/teleport/webroot/app/model/host.py +++ b/server/www/teleport/webroot/app/model/host.py @@ -228,7 +228,7 @@ def update_host(handler, args): return TPE_NOT_EXISTS sql_list = [] - sql = 'UPDATE `{}host` SET `os_type`="{os_type}", `name`="{name}", `ip`="{ip}", `router_ip`="{router_ip}", ' \ + sql = 'UPDATE `{}host` SET `os_type`={os_type}, `name`="{name}", `ip`="{ip}", `router_ip`="{router_ip}", ' \ '`router_port`={router_port}, `cid`="{cid}", `desc`="{desc}" WHERE `id`={host_id};' \ ''.format(db.table_prefix, os_type=args['os_type'], name=args['name'], ip=args['ip'], router_ip=args['router_ip'], router_port=args['router_port'], @@ -245,7 +245,7 @@ def update_host(handler, args): _name = args['ip'] if len(args['name']) > 0: _name = '{} [{}]'.format(args['name'], args['ip']) - sql_list = [] + # 运维授权 sql = 'UPDATE `{}ops_auz` SET `name`="{name}" WHERE (`rtype`={rtype} AND `rid`={rid});' \ ''.format(db.table_prefix, name=_name, rtype=TP_HOST, rid=args['id'])