Exemplo n.º 1
0
def rightgiveuser(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 = req.GET['userid']
                userinfo = Right.getrightusers(nRightuserid)
                data = Right.getallright(nRightuserid)
                return render_to_response('right/right-giveuser.html', {'data': data, 'datas': userinfo})
            else:
                nUserid = req.session["sess_userid"]
                nRightidList = req.POST.get('rightsid')
                nRightuserName= req.POST.get('username')
                print nRightuserName
                nRightuserId = User.getUserIdbyUsername(nRightuserName)
                print "nRightuserId="
                print nRightuserId

                Right.userrightupdate(nRightuserId,nRightidList)
                return HttpResponseRedirect('/user/userlist/')
Exemplo n.º 2
0
def rightupdate(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':
                nRightid = req.GET['rightsid']
                rightinfo = Right.rightbeforeupdate(nRightid)
                datalist = Right.rightbeforeadd()
                return render_to_response('right/right-update.html', {'data': datalist, 'datas': rightinfo})
            else:
                nUserid = req.session["sess_userid"]
                nRightid = req.GET['rightsid']
                nRightname = req.POST.get('rightname')
                nMenuid = req.POST.get('menuid')
                nAction = req.POST.get('action')
                nStatus = int(req.POST.get('status'))

                Right.rightupdate(nRightname, nAction, nStatus, nMenuid, nRightid)
                return HttpResponseRedirect('/right/rightlist/')
Exemplo n.º 3
0
def rightdelete(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:
            nRightid = req.GET['rightsid']
            Right.rightdelete(nRightid)
            return HttpResponseRedirect('/right/rightlist/')
Exemplo n.º 4
0
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})
Exemplo n.º 5
0
def userupdate(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':
                nNewUserid = req.GET['userid']
                datalist = User.userbeforeupdate(nNewUserid)
                return render_to_response('user/user-update.html',
                                          {'data': datalist})
            else:
                nNewUserid = req.POST.get('olduserid')
                nLoginname = req.POST.get('loginname')
                nLoginpwdold = req.POST.get('oldpwd')
                if req.POST.get('loginpwd') == '':
                    nLoginpwd = nLoginpwdold
                else:
                    nLoginpwd = req.POST.get('loginpwd')
                nUsername = req.POST.get('username')
                nUseremail = req.POST.get('useremail')
                nUsermobile = req.POST.get('usermobile')
                nUserdepartment = req.POST.get('userdepartment')
                nUserrole = req.POST.get('userrole')
                nStatus = req.POST.get('status')

                User.userupdate(nLoginname, nLoginpwd, nUsername, nUseremail,
                                nUsermobile, nUserdepartment, nUserrole,
                                nStatus, nNewUserid)
                return HttpResponseRedirect('/user/userlist/')
Exemplo n.º 6
0
def useradd(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':
                return render_to_response('user/user-add.html')
            else:
                nUserid = req.session["sess_userid"]
                nLoginname = req.POST.get('loginname')
                nLoginpwd = req.POST.get('loginpwd')
                nUsername = req.POST.get('username')
                nUseremail = req.POST.get('useremail')
                nUsermobile = req.POST.get('usermobile')
                nUserrole = int(req.POST.get('userrole'))
                nUserdepartment = req.POST.get('userdepartment')
                nStatus = int(req.POST.get('status'))

                User.useradd(nLoginname, nLoginpwd, nUsername, nUseremail,
                             nUsermobile, nUserrole, nUserdepartment, nStatus)
                return HttpResponseRedirect('/user/userlist/')
Exemplo n.º 7
0
def menuupdate(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':
                nMenuid = req.GET['menuid']
                menuinfo = Memu.menubeforeupdate(nMenuid)
                datalist = Memu.menubeforeadd()
                return render_to_response('menu/menu-update.html', {
                    'data': datalist,
                    'datas': menuinfo
                })
            else:
                nMenuid = req.POST.get('menuid')
                nMenuname = req.POST.get('menuname')
                nParentid = req.POST.get('parentid')
                nAction = req.POST.get('action')
                nStyletype = req.POST.get('styletype')
                nStatus = int(req.POST.get('status'))
                nOrdersort = int(req.POST.get('ordersort'))

                Memu.menuupdate(nMenuid, nMenuname, nParentid, nAction,
                                nStyletype, nStatus, nOrdersort)
                return HttpResponseRedirect('/menu/menulist/')
Exemplo n.º 8
0
def sqlcontentupdate(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':
                nTaskid = req.GET['taskid']
                datalist = MysqlIncedata.sqlcontentinfo(nTaskid)
                nRightUserid = req.session["sess_userid"]
                nUserRole = req.session["sess_userrole"]
                mysqllist = MysqlIncedata.mysqllist(nUserRole, nRightUserid)
                return render_to_response('mysqlincedata/mysql-sqlcontentupdate.html', {'data': datalist ,'mysqldata': mysqllist})
            else:
                nTaskid = req.POST.get('taskid')
                nDbid = req.POST.get('dbid')
                nSqlcontent = req.POST.get('sqlcontent')
                MysqlIncedata.sqlcontentupdate(nTaskid, nDbid, nSqlcontent)


                return HttpResponseRedirect('/mysql/tobeexecutemysqltask/')
Exemplo n.º 9
0
def sqlauditingadd(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(
                    'mysqlsqladvisor/mysql-sqlauditingadd.html',
                    {'data': datalist})
            else:
                nUserid = req.session["sess_userid"]
                nDbid = req.POST.get('dbid')
                nSqlcontent = req.POST.get('sqlcontent')
                MysqlAdvisor.sqladvisor(nDbid, nSqlcontent, nUserid)

                return HttpResponseRedirect('/mysqlindex/sqlauditinglist/')
Exemplo n.º 10
0
def mysqlgraphinfo(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':
                nDbid = int(req.GET['dbid'])
                nEndtime = datetime.datetime.now().strftime(
                    "%Y-%m-%d %H:%M:%S")
                nBegintime = time.strftime(
                    "%Y-%m-%d %H:%M:%S",
                    time.localtime(time.time() - 24 * 60 * 60))
                datalist = Mmonitor.mysqllist()
                dataredisinfo = Mmonitor.mysqlinfo(nDbid)
                datamysqlqps = Mmonitor.mysqldatagrephqps(
                    nDbid, nBegintime, nEndtime)
                datagrephvieprocessllist = Mmonitor.datagrephvieprocessllist(
                    nDbid, nBegintime, nEndtime)

                return render_to_response(
                    'monitor/mysql-graph-info.html', {
                        'data': datalist,
                        'datas': datamysqlqps,
                        'num5': nBegintime,
                        'num6': nEndtime,
                        'datamen': datagrephviewmen,
                        'dataprocesslist': datagrephvieprocessllist
                    })
            else:
                nDbid = req.POST.get('dbid')
                nEndtime = req.POST.get('endtime')
                nBegintime = req.POST.get('begintime')
                datalist = MysqlIncedata.mysqllist()
                datamysqlqps = MysqlIncedata.mysqlinfo(nDbid)
                datagrephviewmen = Mmonitor.mysqldatagrephqps(
                    nDbid, nBegintime, nEndtime)
                datagrephvieprocessllist = Mmonitor.datagrephvieprocessllist(
                    nDbid, nBegintime, nEndtime)

                return render_to_response(
                    'monitor/mysql-graph-info.html', {
                        'data': datalist,
                        'datas': datamysqlqps,
                        'num5': nBegintime,
                        'num6': nEndtime,
                        'datamen': datagrephviewmen,
                        'dataprocesslist': datagrephvieprocessllist
                    })
Exemplo n.º 11
0
def serveruselist(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.serveruselist()
            return render_to_response('server/server-use-list.html',
                                      {'data': datalist})
Exemplo n.º 12
0
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/')
Exemplo n.º 13
0
def sqlcheckresult(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']
            datalist = MysqlIncedata.sqlcheckresult(nTaskid)
            return render_to_response('mysqlincedata/mysql-sqlcheckresult.html', {'data': datalist})
Exemplo n.º 14
0
def mysqlmonitorlist(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 = Mmonitor.mysqllist()
            return render_to_response('monitor/mysql-monitor-list.html',
                                      {'data': datalist})
Exemplo n.º 15
0
def sqltaskdelete(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']
            MysqlIncedata.sqltaskdelete(nTaskid)
            return HttpResponseRedirect("/mysql/tobeexecutemysqltask/")
Exemplo n.º 16
0
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})
Exemplo n.º 17
0
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})
Exemplo n.º 18
0
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/')
Exemplo n.º 19
0
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})
Exemplo n.º 20
0
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})
Exemplo n.º 21
0
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/')
Exemplo n.º 22
0
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/')
Exemplo n.º 23
0
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})
Exemplo n.º 24
0
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/')
Exemplo n.º 25
0
def left(req):
    nRightuserid = req.session["sess_userid"]
    nRightuserrole = req.session["sess_userrole"]
    datalist = Right.leftmenuright(nRightuserid,nRightuserrole)
    return render_to_response('left.html', {'data': datalist})