def servergrouplist(req): if not req.session.get("sess_userid", False): return HttpResponseRedirect("/login/") else: nUrldata = req.path nRightUserid = req.session["sess_userid"] nHaveRight = Right.userrightcheck(nRightUserid, nUrldata) if nHaveRight[0]["num"] == 0: return HttpResponseRedirect("/noright/") else: datalist = Server.servergrouplist() return render_to_response('server/server-group-list.html', {'data': datalist})
def servergetinfo(req): if not req.session.get("sess_userid", False): return HttpResponseRedirect("/login/") else: nUrldata = req.path nRightUserid = req.session["sess_userid"] nHaveRight = Right.userrightcheck(nRightUserid, nUrldata) if nHaveRight[0]["num"] == 0: return HttpResponseRedirect("/noright/") else: nServerid = req.GET['serverid'] ServerInfo.servergetinfo(nServerid) return HttpResponseRedirect('/server/serverlist/')
def mysqllist(req): if not req.session.get("sess_userid", False): return HttpResponseRedirect("/login/") else: nUrldata = req.path nRightUserid = req.session["sess_userid"] nUserRole = req.session["sess_userrole"] nHaveRight = Right.userrightcheck(nRightUserid, nUrldata) if nHaveRight[0]["num"] == 0: return HttpResponseRedirect("/noright/") else: datalist = MysqlIncedata.mysqllist(nUserRole, nRightUserid) rowdata = MysqlIncedata.gettastnum(nUserRole, nRightUserid) return render_to_response('mysqlincedata/mysql-list.html', {'data': datalist, 'nums': rowdata})
def tobeexecutemysqltask(req): if not req.session.get("sess_userid", False): return HttpResponseRedirect("/login/") else: nUrldata = req.path nRightUserid = req.session["sess_userid"] nHaveRight = Right.userrightcheck(nRightUserid, nUrldata) if nHaveRight[0]["num"] == 0: return HttpResponseRedirect("/noright/") else: nRightUserid = req.session["sess_userid"] nUserRole = req.session["sess_userrole"] datalist = MysqlIncedata.tobeexecutemysqltask(nUserRole, nRightUserid) return render_to_response('mysqlincedata/mysql-tobeexecute.html', {'data': datalist})
def sqlexecnoince(req): if not req.session.get("sess_userid", False): return HttpResponseRedirect("/login/") else: nUrldata = req.path nRightUserid = req.session["sess_userid"] nHaveRight = Right.userrightcheck(nRightUserid, nUrldata) if nHaveRight[0]["num"] == 0: return HttpResponseRedirect("/noright/") else: nTaskid = req.GET['taskid'] nRightUserid = req.session["sess_userid"] MysqlIncedata.sqlexecnoince(nTaskid, nRightUserid) return HttpResponseRedirect("/mysql/mysqlfinishtask/")
def menudelete(req): if not req.session.get("sess_userid", False): return HttpResponseRedirect("/login/") else: nUrldata = req.path nRightUserid = req.session["sess_userid"] nHaveRight = Right.userrightcheck(nRightUserid, nUrldata) if nHaveRight[0]["num"] == 0: return HttpResponseRedirect("/noright/") else: nUserid = req.session["sess_userid"] nMenuid = req.GET['menuid'] Memu.menudelete(nMenuid) return HttpResponseRedirect('/menu/menulist/')
def mysqlbackuplist(req): if not req.session.get("sess_userid", False): return HttpResponseRedirect("/login/") else: nUrldata = req.path nRightUserid = req.session["sess_userid"] nUserRole = req.session["sess_userrole"] nHaveRight = Right.userrightcheck(nRightUserid, nUrldata) if nHaveRight[0]["num"] == 0: return HttpResponseRedirect("/noright/") else: datalist = MysqlBackup.mysqlbackuplist(nUserRole, nRightUserid) return render_to_response('mysqlbackup/mysql-backuplist.html', {'data': datalist})
def rightlist(req): if not req.session.get("sess_userid", False): return HttpResponseRedirect("/login/") else: nUrldata = req.path nRightUserid = req.session["sess_userid"] nHaveRight = Right.userrightcheck(nRightUserid, nUrldata) if nHaveRight[0]["num"] == 0: return HttpResponseRedirect("/noright/") else: nRightuserid = 0 userinfo = Right.getrightusers(nRightuserid) userlen = len(userinfo) datalist = Right.rightlist() return render_to_response('right/right-list.html', {'data': datalist, 'datas': userlen})
def sqladvisorinfo(req): if not req.session.get("sess_userid", False): return HttpResponseRedirect("/login/") else: nUrldata = req.path nRightUserid = req.session["sess_userid"] nUserRole = req.session["sess_userrole"] nHaveRight = Right.userrightcheck(nRightUserid, nUrldata) if nHaveRight[0]["num"] == 0: return HttpResponseRedirect("/noright/") else: nAid = req.GET['id'] datalist = MysqlAdvisor.mysqladvisorinfo(nAid) return render_to_response( 'mysqlsqladvisor/mysql-sqladvisorinfo.html', {'data': datalist})
def serverupdate(req): if not req.session.get("sess_userid", False): return HttpResponseRedirect("/login/") else: nUrldata = req.path nRightUserid = req.session["sess_userid"] nHaveRight = Right.userrightcheck(nRightUserid, nUrldata) if nHaveRight[0]["num"] == 0: return HttpResponseRedirect("/noright/") else: if req.method == 'GET': nServerid = req.GET['serverid'] serverinfo = Server.serverbeforeupdate(nServerid) datalist = Server.serveruselist() datainfo = Server.servergrouplist() print datalist return render_to_response('server/server-update.html', { 'datas': serverinfo, 'info': datainfo, 'data': datalist }) else: nServerid = req.GET['serverid'] nServername = req.POST.get('servername') nServersourceid = req.POST.get('serversourceid') nServergroupid = req.POST.get('servergroupid') nServertype = req.POST.get('servertype') nServeruseid = req.POST.get('serveruseid') nOuternet = req.POST.get('outernet') nInnernet = req.POST.get('innernet') nUseouterinner = req.POST.get('useouterinner') nServerloginuser = req.POST.get('serverloginuser') nServerloginpwd = req.POST.get('serverloginpwd') nSshport = req.POST.get('sshport') nHostname = req.POST.get('hostname') nCpunum = req.POST.get('cpunum') nMemorynum = req.POST.get('memorynum') nSystemname = req.POST.get('systemname') Server.serverupdate(nServerid, nServername, nServersourceid, nServergroupid, nServertype, nServeruseid, nOuternet, nInnernet, nUseouterinner, nServerloginuser, nServerloginpwd, nSshport) return HttpResponseRedirect('/server/serverlist/')
def servergroupupdate(req): if not req.session.get("sess_userid", False): return HttpResponseRedirect("/login/") else: nUrldata = req.path nRightUserid = req.session["sess_userid"] nHaveRight = Right.userrightcheck(nRightUserid, nUrldata) print nHaveRight if nHaveRight[0]["num"] == 0: return HttpResponseRedirect("/noright/") else: if req.method == 'GET': return render_to_response('server/server-group-add.html') else: nServerGroupName = req.POST.get('servergroupname') Server.servergroupadd(nServerGroupName) return HttpResponseRedirect('/server/servergrouplist/')
def sqlresultselect(req): if not req.session.get("sess_userid", False): return HttpResponseRedirect("/login/") else: nUrldata = req.path nRightUserid = req.session["sess_userid"] nHaveRight = Right.userrightcheck(nRightUserid, nUrldata) if nHaveRight[0]["num"] == 0: return HttpResponseRedirect("/noright/") else: if req.method == 'GET': datalist = '' return render_to_response('mysqlincedata/mysql-resultselect.html', {'data': datalist}) else: nContentinfo = req.POST.get('contentinfo') nSelectDate = req.POST.get('selecttime') print nContentinfo,nSelectDate datalist = MysqlIncedata.sqlresultselect(nContentinfo, nSelectDate) return render_to_response('mysqlincedata/mysql-resultselect.html', {'data': datalist, 'num1':nSelectDate, 'num2':nContentinfo})
def rightadd(req): if not req.session.get("sess_userid", False): return HttpResponseRedirect("/login/") else: nUrldata = req.path nRightUserid = req.session["sess_userid"] nHaveRight = Right.userrightcheck(nRightUserid, nUrldata) if nHaveRight[0]["num"] == 0: return HttpResponseRedirect("/noright/") else: if req.method == 'GET': datalist = Right.rightbeforeadd() return render_to_response('right/right-add.html', {'data': datalist}) else: nUserid = req.session["sess_userid"] nRightname = req.POST.get('rightname') nMneuid = int(req.POST.get('menuid')) nAction = req.POST.get('action') nStatus = int(req.POST.get('status')) Right.rightadd(nRightname, nAction, nStatus, nMneuid) return HttpResponseRedirect('/right/rightlist/')
def mysqlsqltask(req): if not req.session.get("sess_userid", False): return HttpResponseRedirect("/login/") else: nUrldata = req.path nRightUserid = req.session["sess_userid"] nUserRole = req.session["sess_userrole"] nHaveRight = Right.userrightcheck(nRightUserid, nUrldata) if nHaveRight[0]["num"] == 0: return HttpResponseRedirect("/noright/") else: if req.method == 'GET': nRightUserid = req.session["sess_userid"] nUserRole = req.session["sess_userrole"] datalist = MysqlIncedata.mysqllist(nUserRole, nRightUserid) return render_to_response('mysqlincedata/mysql-sqltask.html', {'data': datalist}) else: nUserid = req.session["sess_userid"] nDbid = req.POST.get('dbid') nSqlcontent= req.POST.get('sqlcontent') MysqlIncedata.addmysqlsqltask(nDbid, nSqlcontent, nUserid) return HttpResponseRedirect('/mysql/tobeexecutemysqltask/')
def adduserright(req): if not req.session.get("sess_userid", False): return HttpResponseRedirect("/login/") else: nUrldata = req.path nRightUserid = req.session["sess_userid"] nHaveRight = Right.userrightcheck(nRightUserid, nUrldata) if nHaveRight[0]["num"] == 0: return HttpResponseRedirect("/noright/") else: if req.method == 'GET': nRightuserid = 0 userinfo = Right.getrightusers(nRightuserid) data = Right.getallright(nRightuserid) return render_to_response('right/right-adduserright.html', {'data': data, 'datas': userinfo}) else: nUserid = req.session["sess_userid"] nRightidList = req.POST.get('rightsid') nRightuserName= req.POST.get('username') nRightuserId = User.getUserIdbyUsername(nRightuserName) Right.userrightupdate(nRightuserId,nRightidList) return HttpResponseRedirect('/user/userlist/')
def serveradd(req): if not req.session.get("sess_userid", False): return HttpResponseRedirect("/login/") else: nUrldata = req.path nRightUserid = req.session["sess_userid"] nHaveRight = Right.userrightcheck(nRightUserid, nUrldata) print nHaveRight if nHaveRight[0]["num"] == 0: return HttpResponseRedirect("/noright/") else: if req.method == 'GET': datalist = Server.serveruselist() datainfo = Server.servergrouplist() return render_to_response('server/server-add.html', { 'data': datalist, 'info': datainfo }) else: nServername = req.POST.get('servername') nServersourceid = int(req.POST.get('serversourceid')) nServertype = int(req.POST.get('servertype')) nServergroupid = int(req.POST.get('servergroupid')) nServeruseid = int(req.POST.get('serveruseid')) nOuternet = req.POST.get('outernet') nInnernet = req.POST.get('innernet') nUseouterinner = req.POST.get('useouterinner') nServerloginuser = req.POST.get('serverloginuser') nServerloginpwd = req.POST.get('serverloginpwd') nSshport = req.POST.get('sshport') Server.serveradd(nServername, nServersourceid, nServertype, nServergroupid, nServeruseid, nOuternet, nInnernet, nUseouterinner, nServerloginuser, nServerloginpwd, nSshport) return HttpResponseRedirect('/server/serverlist/')