diff --git a/jumpserver.conf b/jumpserver.conf index 9afed3280..0aeb5936d 100644 --- a/jumpserver.conf +++ b/jumpserver.conf @@ -1,19 +1,16 @@ #coding:utf-8 [db] -host = 127.0.0.1 -port = 3306 -user = root -password = redhat -db = jumpserver +host = 127.0.0.1 # mysql host +port = 3306 # mysql port +user = root # mysql user +password = redhat # mysql password +db = jumpserver # mysql db [jumpserver] -user_table = UserManage_user -assets_table = Assets_assets -assets_user_table = Assets_assetsuser -key = 88aaaf7ffe3c6c04 -ldap_host = ldap://127.0.0.1:389 -ldap_base_dn = dc=yolu,dc=com -admin_cn = cn=admin,dc=yolu,dc=com -admin_pass = VNLqNCjpNBIetEoCA2h3 -web_socket_host = 172.10.10.9:3000 \ No newline at end of file +key = 88aaaf7ffe3c6c04 # encrypt key +ldap_host = ldap://127.0.0.1:389 # ldap url +ldap_base_dn = dc=yolu,dc=com # baseDN +admin_cn = cn=admin,dc=yolu,dc=com # admin_cn in slapd.conf defined +admin_pass = VNLqNCjpNBIetEoCA2h3 # admin_cn password in slapd.conf defined +web_socket_host = 172.10.10.9:3000 # websocket url Need modify, jumpserver IP , port default is 3000 \ No newline at end of file diff --git a/jumpserver.py b/jumpserver.py index 2c38a7371..820cb4e90 100755 --- a/jumpserver.py +++ b/jumpserver.py @@ -152,7 +152,10 @@ def ip_all_select(username): """select all the server of the user can control.""" ip_all = [] ip_all_dict = {} - user = User.objects.get(username=username) + try: + user = User.objects.get(username=username) + except: + return (['error'], {'error':"Don't Use Root To Do That or User isn't Exist."}) all_assets_user = user.assetsuser_set.all() for assets_user in all_assets_user: ip_all.append(assets_user.aid.ip) diff --git a/webroot/AutoSa/websocket/index.js b/webroot/AutoSa/websocket/index.js index f5eb495f1..34e8abf43 100644 --- a/webroot/AutoSa/websocket/index.js +++ b/webroot/AutoSa/websocket/index.js @@ -51,7 +51,7 @@ io.on('connection', function(socket){ } //向所有客户端广播用户加入 - io.emit('login', {onlineUsers:onlineUsers, onlineCount:onlineCount, user:obj}); + //io.emit('login', {onlineUsers:onlineUsers, onlineCount:onlineCount, user:obj}); //console.log(obj.username+'加入了聊天室'); }); @@ -72,7 +72,7 @@ io.on('connection', function(socket){ onlineCount--; //向所有客户端广播用户退出 - io.emit('logout', {onlineUsers:onlineUsers, onlineCount:onlineCount, user:obj}); + //io.emit('logout', {onlineUsers:onlineUsers, onlineCount:onlineCount, user:obj}); ////console.log(obj.username+'退出了聊天室'); } }); @@ -80,7 +80,7 @@ io.on('connection', function(socket){ //监听用户发布聊天内容 socket.on('message', function(obj){ //向所有客户端广播发布的消息 - io.emit('message', obj); + //io.emit('message', obj); socket.emit('message',obj); ////console.log(obj.username+'说:'+obj.content); });