mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 13:56:01 +01:00
add default renderer to serverLogs
This commit is contained in:
@@ -1,117 +1,45 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
from django.shortcuts import render,redirect
|
|
||||||
from loginSystem.views import loadLoginPage
|
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
import json
|
import json
|
||||||
import plogical.CyberCPLogFileWriter as logging
|
import plogical.CyberCPLogFileWriter as logging
|
||||||
|
from plogical.httpProc import httpProc
|
||||||
from plogical.installUtilities import installUtilities
|
from plogical.installUtilities import installUtilities
|
||||||
import subprocess
|
|
||||||
import shlex
|
|
||||||
from plogical.virtualHostUtilities import virtualHostUtilities
|
from plogical.virtualHostUtilities import virtualHostUtilities
|
||||||
from plogical.acl import ACLManager
|
from plogical.acl import ACLManager
|
||||||
from plogical.processUtilities import ProcessUtilities
|
from plogical.processUtilities import ProcessUtilities
|
||||||
import os
|
import os
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
||||||
|
|
||||||
def logsHome(request):
|
def logsHome(request):
|
||||||
try:
|
proc = httpProc(request, 'serverLogs/index.html',
|
||||||
userID = request.session['userID']
|
None, 'admin')
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
return proc.render()
|
||||||
|
|
||||||
if currentACL['admin'] == 1:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
return ACLManager.loadError()
|
|
||||||
|
|
||||||
except KeyError:
|
|
||||||
return redirect(loadLoginPage)
|
|
||||||
|
|
||||||
return render(request,'serverLogs/index.html')
|
|
||||||
|
|
||||||
def accessLogs(request):
|
def accessLogs(request):
|
||||||
try:
|
proc = httpProc(request, 'serverLogs/accessLogs.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,'serverLogs/accessLogs.html')
|
|
||||||
|
|
||||||
except KeyError as msg:
|
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[accessLogs]")
|
|
||||||
return redirect(loadLoginPage)
|
|
||||||
|
|
||||||
def errorLogs(request):
|
def errorLogs(request):
|
||||||
try:
|
proc = httpProc(request, 'serverLogs/errorLogs.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,'serverLogs/errorLogs.html')
|
|
||||||
|
|
||||||
except KeyError as msg:
|
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[accessLogs]")
|
|
||||||
return redirect(loadLoginPage)
|
|
||||||
|
|
||||||
def ftplogs(request):
|
def ftplogs(request):
|
||||||
try:
|
proc = httpProc(request, 'serverLogs/ftplogs.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,'serverLogs/ftplogs.html')
|
|
||||||
|
|
||||||
except KeyError as msg:
|
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[accessLogs]")
|
|
||||||
return redirect(loadLoginPage)
|
|
||||||
|
|
||||||
def emailLogs(request):
|
def emailLogs(request):
|
||||||
try:
|
proc = httpProc(request, 'serverLogs/emailLogs.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,'serverLogs/emailLogs.html')
|
|
||||||
|
|
||||||
except KeyError as msg:
|
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[accessLogs]")
|
|
||||||
return redirect(loadLoginPage)
|
|
||||||
|
|
||||||
def modSecAuditLogs(request):
|
def modSecAuditLogs(request):
|
||||||
try:
|
proc = httpProc(request, 'serverLogs/modSecAuditLog.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,'serverLogs/modSecAuditLog.html')
|
|
||||||
|
|
||||||
except KeyError as msg:
|
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[accessLogs]")
|
|
||||||
return redirect(loadLoginPage)
|
|
||||||
|
|
||||||
def getLogsFromFile(request):
|
def getLogsFromFile(request):
|
||||||
try:
|
try:
|
||||||
@@ -205,30 +133,19 @@ def clearLogFile(request):
|
|||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
def serverMail(request):
|
def serverMail(request):
|
||||||
try:
|
smtpPath = '/home/cyberpanel/smtpDetails'
|
||||||
userID = request.session['userID']
|
data = {}
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
|
||||||
|
|
||||||
if currentACL['admin'] == 1:
|
if os.path.exists(smtpPath):
|
||||||
pass
|
mailSettings = json.loads(open(smtpPath, 'r').read())
|
||||||
else:
|
data['smtpHost'] = mailSettings['smtpHost']
|
||||||
return ACLManager.loadError()
|
data['smtpPort'] = mailSettings['smtpPort']
|
||||||
|
data['smtpUserName'] = mailSettings['smtpUserName']
|
||||||
|
data['smtpPassword'] = mailSettings['smtpPassword']
|
||||||
|
|
||||||
smtpPath = '/home/cyberpanel/smtpDetails'
|
proc = httpProc(request, 'serverLogs/serverMail.html',
|
||||||
data = {}
|
data, 'admin')
|
||||||
|
return proc.render()
|
||||||
if os.path.exists(smtpPath):
|
|
||||||
mailSettings = json.loads(open(smtpPath, 'r').read())
|
|
||||||
data['smtpHost'] = mailSettings['smtpHost']
|
|
||||||
data['smtpPort'] = mailSettings['smtpPort']
|
|
||||||
data['smtpUserName'] = mailSettings['smtpUserName']
|
|
||||||
data['smtpPassword'] = mailSettings['smtpPassword']
|
|
||||||
|
|
||||||
return render(request,'serverLogs/serverMail.html', data)
|
|
||||||
|
|
||||||
except KeyError as msg:
|
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[accessLogs]")
|
|
||||||
return redirect(loadLoginPage)
|
|
||||||
|
|
||||||
def saveSMTPSettings(request):
|
def saveSMTPSettings(request):
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user