add default renderer to tuning

This commit is contained in:
Usman Nasir
2021-03-03 19:29:48 +05:00
parent db9ecbdfa8
commit 35bcc1f6c3

View File

@@ -2,10 +2,13 @@
import os.path import os.path
import sys import sys
import django import django
from plogical.httpProc import httpProc
sys.path.append('/usr/local/CyberCP') sys.path.append('/usr/local/CyberCP')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
django.setup() django.setup()
from django.shortcuts import render,redirect from django.shortcuts import redirect
from django.http import HttpResponse from django.http import HttpResponse
import json import json
import plogical.CyberCPLogFileWriter as logging import plogical.CyberCPLogFileWriter as logging
@@ -18,49 +21,31 @@ from plogical.processUtilities import ProcessUtilities
class tuningManager: class tuningManager:
def loadTuningHome(self, request, userID): def loadTuningHome(self, request, userID):
try: proc = httpProc(request, 'tuning/index.html',
userID = request.session['userID'] None, 'admin')
currentACL = ACLManager.loadedACL(userID) return proc.render()
if currentACL['admin'] == 1:
pass
else:
return ACLManager.loadError()
return render(request, 'tuning/index.html', {})
except KeyError:
return redirect(loadLoginPage)
def liteSpeedTuning(self, request, userID): def liteSpeedTuning(self, request, userID):
try: proc = httpProc(request, 'tuning/liteSpeedTuning.html',
userID = request.session['userID'] None, 'admin')
currentACL = ACLManager.loadedACL(userID) return proc.render()
if currentACL['admin'] == 1:
pass
else:
return ACLManager.loadError()
return render(request, 'tuning/liteSpeedTuning.html', {})
except KeyError:
return redirect(loadLoginPage)
def phpTuning(self, request, userID): def phpTuning(self, request, userID):
try: try:
userID = request.session['userID'] userID = request.session['userID']
currentACL = ACLManager.loadedACL(userID) currentACL = ACLManager.loadedACL(userID)
if currentACL['admin'] == 1:
pass
else:
return ACLManager.loadError()
if ProcessUtilities.decideServer() == ProcessUtilities.OLS: if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
websitesName = ACLManager.findAllSites(currentACL, userID) websitesName = ACLManager.findAllSites(currentACL, userID)
OLS = 1 OLS = 1
return render(request, 'tuning/phpTuning.html', {'websiteList': websitesName, 'OLS': OLS}) proc = httpProc(request, 'tuning/phpTuning.html',
{'websiteList': websitesName, 'OLS': OLS}, 'admin')
return proc.render()
else: else:
OLS = 0 OLS = 0
return render(request, 'tuning/phpTuning.html', {'OLS': OLS}) proc = httpProc(request, 'tuning/phpTuning.html',
{'OLS': OLS}, 'admin')
return proc.render()
except KeyError: except KeyError:
return redirect(loadLoginPage) return redirect(loadLoginPage)