mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 14:26:16 +01:00
follow PEP 8 style guide
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
import smtplib
|
import smtplib
|
||||||
import time
|
import time
|
||||||
import argparse
|
import argparse
|
||||||
import subprocess, shlex
|
import subprocess
|
||||||
|
import shlex
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
class BackupUtil:
|
class BackupUtil:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -53,8 +55,6 @@ class BackupUtil:
|
|||||||
subprocess.call(command, shell=True)
|
subprocess.call(command, shell=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='CyberPanel Backup tool.')
|
parser = argparse.ArgumentParser(description='CyberPanel Backup tool.')
|
||||||
|
|||||||
32
api/views.py
32
api/views.py
@@ -23,6 +23,7 @@ from userManagment.views import submitUserCreation as suc
|
|||||||
from userManagment.views import submitUserDeletion as duc
|
from userManagment.views import submitUserDeletion as duc
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def verifyConn(request):
|
def verifyConn(request):
|
||||||
try:
|
try:
|
||||||
@@ -53,6 +54,7 @@ def verifyConn(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def createWebsite(request):
|
def createWebsite(request):
|
||||||
data = json.loads(request.body)
|
data = json.loads(request.body)
|
||||||
@@ -68,6 +70,7 @@ def createWebsite(request):
|
|||||||
wm = WebsiteManager()
|
wm = WebsiteManager()
|
||||||
return wm.createWebsiteAPI(json.loads(request.body))
|
return wm.createWebsiteAPI(json.loads(request.body))
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def getPackagesListAPI(request):
|
def getPackagesListAPI(request):
|
||||||
data = json.loads(request.body)
|
data = json.loads(request.body)
|
||||||
@@ -86,6 +89,7 @@ def getPackagesListAPI(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def getUserInfo(request):
|
def getUserInfo(request):
|
||||||
try:
|
try:
|
||||||
@@ -132,6 +136,7 @@ def getUserInfo(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def changeUserPassAPI(request):
|
def changeUserPassAPI(request):
|
||||||
try:
|
try:
|
||||||
@@ -160,7 +165,6 @@ def changeUserPassAPI(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
websiteOwn = Administrator.objects.get(userName=websiteOwner)
|
websiteOwn = Administrator.objects.get(userName=websiteOwner)
|
||||||
websiteOwn.password = hashPassword.hash_password(ownerPassword)
|
websiteOwn.password = hashPassword.hash_password(ownerPassword)
|
||||||
websiteOwn.save()
|
websiteOwn.save()
|
||||||
@@ -174,6 +178,7 @@ def changeUserPassAPI(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def submitUserDeletion(request):
|
def submitUserDeletion(request):
|
||||||
try:
|
try:
|
||||||
@@ -205,6 +210,7 @@ def submitUserDeletion(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def changePackageAPI(request):
|
def changePackageAPI(request):
|
||||||
try:
|
try:
|
||||||
@@ -232,7 +238,6 @@ def changePackageAPI(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
website = Websites.objects.get(domain=websiteName)
|
website = Websites.objects.get(domain=websiteName)
|
||||||
pack = Package.objects.get(packageName=packageName)
|
pack = Package.objects.get(packageName=packageName)
|
||||||
|
|
||||||
@@ -248,6 +253,7 @@ def changePackageAPI(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def deleteWebsite(request):
|
def deleteWebsite(request):
|
||||||
try:
|
try:
|
||||||
@@ -293,6 +299,7 @@ def deleteWebsite(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def submitWebsiteStatus(request):
|
def submitWebsiteStatus(request):
|
||||||
try:
|
try:
|
||||||
@@ -324,6 +331,7 @@ def submitWebsiteStatus(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def loginAPI(request):
|
def loginAPI(request):
|
||||||
try:
|
try:
|
||||||
@@ -348,6 +356,7 @@ def loginAPI(request):
|
|||||||
json_data = json.dumps(data)
|
json_data = json.dumps(data)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def fetchSSHkey(request):
|
def fetchSSHkey(request):
|
||||||
try:
|
try:
|
||||||
@@ -391,6 +400,7 @@ def fetchSSHkey(request):
|
|||||||
json_data = json.dumps(data)
|
json_data = json.dumps(data)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def remoteTransfer(request):
|
def remoteTransfer(request):
|
||||||
try:
|
try:
|
||||||
@@ -400,7 +410,6 @@ def remoteTransfer(request):
|
|||||||
username = data['username']
|
username = data['username']
|
||||||
password = data['password']
|
password = data['password']
|
||||||
|
|
||||||
|
|
||||||
admin = Administrator.objects.get(userName=username)
|
admin = Administrator.objects.get(userName=username)
|
||||||
|
|
||||||
if admin.api == 0:
|
if admin.api == 0:
|
||||||
@@ -443,6 +452,7 @@ def remoteTransfer(request):
|
|||||||
json_data = json.dumps(data)
|
json_data = json.dumps(data)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def fetchAccountsFromRemoteServer(request):
|
def fetchAccountsFromRemoteServer(request):
|
||||||
try:
|
try:
|
||||||
@@ -493,6 +503,7 @@ def fetchAccountsFromRemoteServer(request):
|
|||||||
json_data = json.dumps(data)
|
json_data = json.dumps(data)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def FetchRemoteTransferStatus(request):
|
def FetchRemoteTransferStatus(request):
|
||||||
try:
|
try:
|
||||||
@@ -511,10 +522,9 @@ def FetchRemoteTransferStatus(request):
|
|||||||
dir = "/home/backup/transfer-"+str(data['dir'])+"/backup_log"
|
dir = "/home/backup/transfer-"+str(data['dir'])+"/backup_log"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
command = "cat "+ dir
|
command = f"cat {dir}"
|
||||||
status = ProcessUtilities.outputExecutioner(command)
|
status = ProcessUtilities.outputExecutioner(command)
|
||||||
|
|
||||||
|
|
||||||
if hashPassword.check_password(admin.password, password):
|
if hashPassword.check_password(admin.password, password):
|
||||||
|
|
||||||
final_json = json.dumps({'fetchStatus': 1, 'error_message': "None", "status": status})
|
final_json = json.dumps({'fetchStatus': 1, 'error_message': "None", "status": status})
|
||||||
@@ -527,13 +537,12 @@ def FetchRemoteTransferStatus(request):
|
|||||||
final_json = json.dumps({'fetchStatus': 1, 'error_message': "None", "status": "Just started.."})
|
final_json = json.dumps({'fetchStatus': 1, 'error_message': "None", "status": "Just started.."})
|
||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
data = {'fetchStatus': 0, 'error_message': str(msg)}
|
data = {'fetchStatus': 0, 'error_message': str(msg)}
|
||||||
json_data = json.dumps(data)
|
json_data = json.dumps(data)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def cancelRemoteTransfer(request):
|
def cancelRemoteTransfer(request):
|
||||||
try:
|
try:
|
||||||
@@ -551,8 +560,6 @@ def cancelRemoteTransfer(request):
|
|||||||
|
|
||||||
dir = "/home/backup/transfer-"+str(data['dir'])
|
dir = "/home/backup/transfer-"+str(data['dir'])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if hashPassword.check_password(admin.password, password):
|
if hashPassword.check_password(admin.password, password):
|
||||||
|
|
||||||
path = dir + "/pid"
|
path = dir + "/pid"
|
||||||
@@ -575,12 +582,12 @@ def cancelRemoteTransfer(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
data = {'cancelStatus': 1, 'error_message': str(msg)}
|
data = {'cancelStatus': 1, 'error_message': str(msg)}
|
||||||
json_data = json.dumps(data)
|
json_data = json.dumps(data)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def cyberPanelVersion(request):
|
def cyberPanelVersion(request):
|
||||||
try:
|
try:
|
||||||
@@ -591,7 +598,6 @@ def cyberPanelVersion(request):
|
|||||||
adminUser = data['username']
|
adminUser = data['username']
|
||||||
adminPass = data['password']
|
adminPass = data['password']
|
||||||
|
|
||||||
|
|
||||||
admin = Administrator.objects.get(userName=adminUser)
|
admin = Administrator.objects.get(userName=adminUser)
|
||||||
|
|
||||||
if admin.api == 0:
|
if admin.api == 0:
|
||||||
@@ -628,6 +634,7 @@ def cyberPanelVersion(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def runAWSBackups(request):
|
def runAWSBackups(request):
|
||||||
try:
|
try:
|
||||||
@@ -641,6 +648,7 @@ def runAWSBackups(request):
|
|||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.writeToFile(str(msg) + ' [API.runAWSBackups]')
|
logging.writeToFile(str(msg) + ' [API.runAWSBackups]')
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def submitUserCreation(request):
|
def submitUserCreation(request):
|
||||||
try:
|
try:
|
||||||
@@ -672,6 +680,7 @@ def submitUserCreation(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def addFirewallRule(request):
|
def addFirewallRule(request):
|
||||||
try:
|
try:
|
||||||
@@ -705,6 +714,7 @@ def addFirewallRule(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def deleteFirewallRule(request):
|
def deleteFirewallRule(request):
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -621,8 +621,8 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
clScripts = ['/usr/local/CyberCP/CLScript/panel_info.py', '/usr/local/CyberCP/CLScript/CloudLinuxPackages.py',
|
clScripts = ['/usr/local/CyberCP/CLScript/panel_info.py', '/usr/local/CyberCP/CLScript/CloudLinuxPackages.py',
|
||||||
'/usr/local/CyberCP/CLScript/CloudLinuxUsers.py',
|
'/usr/local/CyberCP/CLScript/CloudLinuxUsers.py',
|
||||||
'/usr/local/CyberCP/CLScript/CloudLinuxDomains.py'
|
'/usr/local/CyberCP/CLScript/CloudLinuxDomains.py',
|
||||||
, '/usr/local/CyberCP/CLScript/CloudLinuxResellers.py', '/usr/local/CyberCP/CLScript/CloudLinuxAdmins.py',
|
'/usr/local/CyberCP/CLScript/CloudLinuxResellers.py', '/usr/local/CyberCP/CLScript/CloudLinuxAdmins.py',
|
||||||
'/usr/local/CyberCP/CLScript/CloudLinuxDB.py', '/usr/local/CyberCP/CLScript/UserInfo.py']
|
'/usr/local/CyberCP/CLScript/CloudLinuxDB.py', '/usr/local/CyberCP/CLScript/UserInfo.py']
|
||||||
|
|
||||||
for items in clScripts:
|
for items in clScripts:
|
||||||
@@ -1374,7 +1374,6 @@ imap_folder_list_limit = 0
|
|||||||
logging.InstallLog.writeToFile("FirewallD installed and configured!")
|
logging.InstallLog.writeToFile("FirewallD installed and configured!")
|
||||||
preFlightsChecks.stdOut("FirewallD installed and configured!")
|
preFlightsChecks.stdOut("FirewallD installed and configured!")
|
||||||
|
|
||||||
|
|
||||||
except OSError as msg:
|
except OSError as msg:
|
||||||
logging.InstallLog.writeToFile('[ERROR] ' + str(msg) + " [installFirewalld]")
|
logging.InstallLog.writeToFile('[ERROR] ' + str(msg) + " [installFirewalld]")
|
||||||
return 0
|
return 0
|
||||||
@@ -1654,7 +1653,6 @@ imap_folder_list_limit = 0
|
|||||||
|
|
||||||
logging.InstallLog.writeToFile("LSCPD Daemon Set!")
|
logging.InstallLog.writeToFile("LSCPD Daemon Set!")
|
||||||
|
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.InstallLog.writeToFile('[ERROR] ' + str(msg) + " [setupLSCPDDaemon]")
|
logging.InstallLog.writeToFile('[ERROR] ' + str(msg) + " [setupLSCPDDaemon]")
|
||||||
return 0
|
return 0
|
||||||
@@ -1895,7 +1893,6 @@ milter_default_action = accept
|
|||||||
command = "systemctl start postfix"
|
command = "systemctl start postfix"
|
||||||
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
|
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
|
||||||
|
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.InstallLog.writeToFile('[ERROR] ' + str(msg) + " [configureOpenDKIM]")
|
logging.InstallLog.writeToFile('[ERROR] ' + str(msg) + " [configureOpenDKIM]")
|
||||||
return 0
|
return 0
|
||||||
@@ -2185,7 +2182,7 @@ def main():
|
|||||||
logging.InstallLog.writeToFile("Starting CyberPanel installation..,10")
|
logging.InstallLog.writeToFile("Starting CyberPanel installation..,10")
|
||||||
preFlightsChecks.stdOut("Starting CyberPanel installation..")
|
preFlightsChecks.stdOut("Starting CyberPanel installation..")
|
||||||
|
|
||||||
if args.ent == None:
|
if args.ent is None:
|
||||||
ent = 0
|
ent = 0
|
||||||
preFlightsChecks.stdOut("OpenLiteSpeed web server will be installed.")
|
preFlightsChecks.stdOut("OpenLiteSpeed web server will be installed.")
|
||||||
else:
|
else:
|
||||||
@@ -2195,7 +2192,7 @@ def main():
|
|||||||
else:
|
else:
|
||||||
preFlightsChecks.stdOut("LiteSpeed Enterprise web server will be installed.")
|
preFlightsChecks.stdOut("LiteSpeed Enterprise web server will be installed.")
|
||||||
ent = 1
|
ent = 1
|
||||||
if args.serial != None:
|
if args.serial is not None:
|
||||||
serial = args.serial
|
serial = args.serial
|
||||||
preFlightsChecks.stdOut("LiteSpeed Enterprise Serial detected: " + serial)
|
preFlightsChecks.stdOut("LiteSpeed Enterprise Serial detected: " + serial)
|
||||||
else:
|
else:
|
||||||
@@ -2241,12 +2238,12 @@ def main():
|
|||||||
remotemysql, mysqlhost, mysqldb, mysqluser, mysqlpassword, mysqlport)
|
remotemysql, mysqlhost, mysqldb, mysqluser, mysqlpassword, mysqlport)
|
||||||
checks.mountTemp()
|
checks.mountTemp()
|
||||||
|
|
||||||
if args.port == None:
|
if args.port is None:
|
||||||
port = "8090"
|
port = "8090"
|
||||||
else:
|
else:
|
||||||
port = args.port
|
port = args.port
|
||||||
|
|
||||||
if args.mysql == None:
|
if args.mysql is None:
|
||||||
mysql = 'One'
|
mysql = 'One'
|
||||||
preFlightsChecks.stdOut("Single MySQL instance version will be installed.")
|
preFlightsChecks.stdOut("Single MySQL instance version will be installed.")
|
||||||
else:
|
else:
|
||||||
@@ -2270,7 +2267,7 @@ def main():
|
|||||||
checks.fix_selinux_issue()
|
checks.fix_selinux_issue()
|
||||||
checks.install_psmisc()
|
checks.install_psmisc()
|
||||||
|
|
||||||
if args.postfix == None:
|
if args.postfix is None:
|
||||||
checks.install_postfix_dovecot()
|
checks.install_postfix_dovecot()
|
||||||
checks.setup_email_Passwords(installCyberPanel.InstallCyberPanel.mysqlPassword, mysql)
|
checks.setup_email_Passwords(installCyberPanel.InstallCyberPanel.mysqlPassword, mysql)
|
||||||
checks.setup_postfix_dovecot_config(mysql)
|
checks.setup_postfix_dovecot_config(mysql)
|
||||||
@@ -2297,7 +2294,7 @@ def main():
|
|||||||
|
|
||||||
## Install and Configure OpenDKIM.
|
## Install and Configure OpenDKIM.
|
||||||
|
|
||||||
if args.postfix == None:
|
if args.postfix is None:
|
||||||
checks.installOpenDKIM()
|
checks.installOpenDKIM()
|
||||||
checks.configureOpenDKIM()
|
checks.configureOpenDKIM()
|
||||||
else:
|
else:
|
||||||
@@ -2311,22 +2308,22 @@ def main():
|
|||||||
checks.setupPythonWSGI()
|
checks.setupPythonWSGI()
|
||||||
checks.setupLSCPDDaemon()
|
checks.setupLSCPDDaemon()
|
||||||
|
|
||||||
if args.redis != None:
|
if args.redis is not None:
|
||||||
checks.installRedis()
|
checks.installRedis()
|
||||||
|
|
||||||
if args.postfix != None:
|
if args.postfix is not None:
|
||||||
checks.enableDisableEmail(args.postfix.lower())
|
checks.enableDisableEmail(args.postfix.lower())
|
||||||
else:
|
else:
|
||||||
preFlightsChecks.stdOut("Postfix will be installed and enabled.")
|
preFlightsChecks.stdOut("Postfix will be installed and enabled.")
|
||||||
checks.enableDisableEmail('on')
|
checks.enableDisableEmail('on')
|
||||||
|
|
||||||
if args.powerdns != None:
|
if args.powerdns is not None:
|
||||||
checks.enableDisableDNS(args.powerdns.lower())
|
checks.enableDisableDNS(args.powerdns.lower())
|
||||||
else:
|
else:
|
||||||
preFlightsChecks.stdOut("PowerDNS will be installed and enabled.")
|
preFlightsChecks.stdOut("PowerDNS will be installed and enabled.")
|
||||||
checks.enableDisableDNS('on')
|
checks.enableDisableDNS('on')
|
||||||
|
|
||||||
if args.ftp != None:
|
if args.ftp is not None:
|
||||||
checks.enableDisableFTP(args.ftp.lower(), distro)
|
checks.enableDisableFTP(args.ftp.lower(), distro)
|
||||||
else:
|
else:
|
||||||
preFlightsChecks.stdOut("Pure-FTPD will be installed and enabled.")
|
preFlightsChecks.stdOut("Pure-FTPD will be installed and enabled.")
|
||||||
|
|||||||
@@ -74,7 +74,6 @@ class InstallCyberPanel:
|
|||||||
command = 'yum install -y openlitespeed'
|
command = 'yum install -y openlitespeed'
|
||||||
install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
|
install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
@@ -201,7 +200,6 @@ class InstallCyberPanel:
|
|||||||
command = 'DEBIAN_FRONTEND=noninteractive apt-get -y install lsphp80*'
|
command = 'DEBIAN_FRONTEND=noninteractive apt-get -y install lsphp80*'
|
||||||
os.system(command)
|
os.system(command)
|
||||||
|
|
||||||
|
|
||||||
elif self.distro == centos:
|
elif self.distro == centos:
|
||||||
command = 'yum -y groupinstall lsphp-all'
|
command = 'yum -y groupinstall lsphp-all'
|
||||||
install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
|
install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
|
||||||
@@ -678,7 +676,7 @@ def Main(cwd, mysql, distro, ent, serial=None, port="8090", ftp=None, dns=None,
|
|||||||
|
|
||||||
mysqlUtilities.createDatabase("cyberpanel", "cyberpanel", InstallCyberPanel.mysqlPassword, publicip)
|
mysqlUtilities.createDatabase("cyberpanel", "cyberpanel", InstallCyberPanel.mysqlPassword, publicip)
|
||||||
|
|
||||||
if ftp == None:
|
if ftp is None:
|
||||||
installer.installPureFTPD()
|
installer.installPureFTPD()
|
||||||
installer.installPureFTPDConfigurations(mysql)
|
installer.installPureFTPDConfigurations(mysql)
|
||||||
installer.startPureFTPD()
|
installer.startPureFTPD()
|
||||||
@@ -688,7 +686,7 @@ def Main(cwd, mysql, distro, ent, serial=None, port="8090", ftp=None, dns=None,
|
|||||||
installer.installPureFTPDConfigurations(mysql)
|
installer.installPureFTPDConfigurations(mysql)
|
||||||
installer.startPureFTPD()
|
installer.startPureFTPD()
|
||||||
|
|
||||||
if dns == None:
|
if dns is None:
|
||||||
installer.installPowerDNS()
|
installer.installPowerDNS()
|
||||||
installer.installPowerDNSConfigurations(InstallCyberPanel.mysqlPassword, mysql)
|
installer.installPowerDNSConfigurations(InstallCyberPanel.mysqlPassword, mysql)
|
||||||
installer.startPowerDNS()
|
installer.startPowerDNS()
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import shlex
|
|||||||
import socket
|
import socket
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class unInstallCyberPanel:
|
class unInstallCyberPanel:
|
||||||
|
|
||||||
def unInstallCyberPanelRepo(self):
|
def unInstallCyberPanelRepo(self):
|
||||||
@@ -18,7 +17,7 @@ class unInstallCyberPanel:
|
|||||||
os.remove(copyPath)
|
os.remove(copyPath)
|
||||||
|
|
||||||
except OSError as msg:
|
except OSError as msg:
|
||||||
logging.InstallLog.writeToFile(str(msg)+ " [unInstallCyberPanelRepo]")
|
logging.InstallLog.writeToFile(f"{str(msg)} [unInstallCyberPanelRepo]")
|
||||||
|
|
||||||
def removeGunicorn(self):
|
def removeGunicorn(self):
|
||||||
try:
|
try:
|
||||||
@@ -33,7 +32,6 @@ class unInstallCyberPanel:
|
|||||||
os.remove(socket)
|
os.remove(socket)
|
||||||
os.remove(conf)
|
os.remove(conf)
|
||||||
|
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.InstallLog.writeToFile(str(msg) + " [removeGunicorn]")
|
logging.InstallLog.writeToFile(str(msg) + " [removeGunicorn]")
|
||||||
|
|
||||||
@@ -71,7 +69,6 @@ class unInstallCyberPanel:
|
|||||||
shutil.rmtree("/var/lib/mysql")
|
shutil.rmtree("/var/lib/mysql")
|
||||||
os.remove("/etc/my.cnf")
|
os.remove("/etc/my.cnf")
|
||||||
|
|
||||||
|
|
||||||
except OSError as msg:
|
except OSError as msg:
|
||||||
logging.InstallLog.writeToFile(str(msg) + " [removeMysql]")
|
logging.InstallLog.writeToFile(str(msg) + " [removeMysql]")
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ from django.db import models
|
|||||||
from CyberCP.SecurityLevel import SecurityLevel
|
from CyberCP.SecurityLevel import SecurityLevel
|
||||||
|
|
||||||
|
|
||||||
# Create your models here.
|
|
||||||
class ACL(models.Model):
|
class ACL(models.Model):
|
||||||
name = models.CharField(unique=True, max_length=50)
|
name = models.CharField(unique=True, max_length=50)
|
||||||
adminStatus = models.IntegerField(default=0)
|
adminStatus = models.IntegerField(default=0)
|
||||||
@@ -75,7 +74,6 @@ class ACL(models.Model):
|
|||||||
config = models.TextField(default='{}')
|
config = models.TextField(default='{}')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Administrator(models.Model):
|
class Administrator(models.Model):
|
||||||
userName = models.CharField(unique=True, max_length=50)
|
userName = models.CharField(unique=True, max_length=50)
|
||||||
password = models.CharField(max_length=200)
|
password = models.CharField(max_length=200)
|
||||||
@@ -86,10 +84,7 @@ class Administrator(models.Model):
|
|||||||
owner = models.IntegerField(default=1)
|
owner = models.IntegerField(default=1)
|
||||||
token = models.CharField(max_length=500, default='None')
|
token = models.CharField(max_length=500, default='None')
|
||||||
api = models.IntegerField(default=0)
|
api = models.IntegerField(default=0)
|
||||||
securityLevel = models.IntegerField(
|
securityLevel = models.IntegerField(default=0, choices=[(tag, tag.value) for tag in SecurityLevel])
|
||||||
default=0,
|
|
||||||
choices=[(tag, tag.value) for tag in SecurityLevel]
|
|
||||||
)
|
|
||||||
state = models.CharField(max_length=10, default='ACTIVE')
|
state = models.CharField(max_length=10, default='ACTIVE')
|
||||||
|
|
||||||
initWebsitesLimit = models.IntegerField(default=0)
|
initWebsitesLimit = models.IntegerField(default=0)
|
||||||
@@ -97,12 +92,3 @@ class Administrator(models.Model):
|
|||||||
twoFA = models.IntegerField(default=0)
|
twoFA = models.IntegerField(default=0)
|
||||||
secretKey = models.CharField(max_length=50, default='None')
|
secretKey = models.CharField(max_length=50, default='None')
|
||||||
config = models.TextField(default='{}')
|
config = models.TextField(default='{}')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -36,11 +36,9 @@ class TestLogin(TestCase):
|
|||||||
json_data = json.loads(response.content)
|
json_data = json.loads(response.content)
|
||||||
self.assertEqual(json_data['loginStatus'], 1)
|
self.assertEqual(json_data['loginStatus'], 1)
|
||||||
|
|
||||||
|
|
||||||
## Verify
|
## Verify
|
||||||
|
|
||||||
response = self.client.get(self.adminLogin)
|
response = self.client.get(self.adminLogin)
|
||||||
self.assertTemplateUsed(response, 'baseTemplate/homePage.html')
|
self.assertTemplateUsed(response, 'baseTemplate/homePage.html')
|
||||||
##logging.writeToFile(result.content)
|
##logging.writeToFile(result.content)
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ from django.utils import translation
|
|||||||
VERSION = '2.1'
|
VERSION = '2.1'
|
||||||
BUILD = 1
|
BUILD = 1
|
||||||
|
|
||||||
|
|
||||||
def verifyLogin(request):
|
def verifyLogin(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -83,7 +84,6 @@ def verifyLogin(request):
|
|||||||
response = HttpResponse()
|
response = HttpResponse()
|
||||||
response.set_cookie(settings.LANGUAGE_COOKIE_NAME, user_Language)
|
response.set_cookie(settings.LANGUAGE_COOKIE_NAME, user_Language)
|
||||||
|
|
||||||
|
|
||||||
admin = Administrator.objects.get(userName=username)
|
admin = Administrator.objects.get(userName=username)
|
||||||
|
|
||||||
if admin.state == 'SUSPENDED':
|
if admin.state == 'SUSPENDED':
|
||||||
@@ -101,8 +101,6 @@ def verifyLogin(request):
|
|||||||
response.write(json_data)
|
response.write(json_data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if hashPassword.check_password(admin.password, password):
|
if hashPassword.check_password(admin.password, password):
|
||||||
if admin.twoFA:
|
if admin.twoFA:
|
||||||
if request.session['twofa'] == 0:
|
if request.session['twofa'] == 0:
|
||||||
@@ -143,6 +141,7 @@ def verifyLogin(request):
|
|||||||
json_data = json.dumps(data)
|
json_data = json.dumps(data)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
@ensure_csrf_cookie
|
@ensure_csrf_cookie
|
||||||
def loadLoginPage(request):
|
def loadLoginPage(request):
|
||||||
try:
|
try:
|
||||||
@@ -226,14 +225,14 @@ def loadLoginPage(request):
|
|||||||
vers = version(currentVersion=VERSION, build=BUILD)
|
vers = version(currentVersion=VERSION, build=BUILD)
|
||||||
vers.save()
|
vers.save()
|
||||||
|
|
||||||
package = Package(admin=admin, packageName="Default", diskSpace=1000,
|
package = Package(admin=admin, packageName="Default", diskSpace=1000, bandwidth=1000, ftpAccounts=1000,
|
||||||
bandwidth=1000, ftpAccounts=1000, dataBases=1000,
|
dataBases=1000, emailAccounts=1000, allowedDomains=20)
|
||||||
emailAccounts=1000,allowedDomains=20)
|
|
||||||
package.save()
|
package.save()
|
||||||
return render(request, 'loginSystem/login.html', {})
|
return render(request, 'loginSystem/login.html', {})
|
||||||
else:
|
else:
|
||||||
return render(request, 'loginSystem/login.html', {})
|
return render(request, 'loginSystem/login.html', {})
|
||||||
|
|
||||||
|
|
||||||
@ensure_csrf_cookie
|
@ensure_csrf_cookie
|
||||||
def logout(request):
|
def logout(request):
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -3,12 +3,11 @@
|
|||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
# Create your models here.
|
|
||||||
|
|
||||||
|
|
||||||
class PHP(models.Model):
|
class PHP(models.Model):
|
||||||
phpVers = models.CharField(max_length=5, unique=True)
|
phpVers = models.CharField(max_length=5, unique=True)
|
||||||
|
|
||||||
|
|
||||||
class installedPackages(models.Model):
|
class installedPackages(models.Model):
|
||||||
phpVers = models.ForeignKey(PHP, on_delete=models.CASCADE)
|
phpVers = models.ForeignKey(PHP, on_delete=models.CASCADE)
|
||||||
extensionName = models.CharField(max_length=50)
|
extensionName = models.CharField(max_length=50)
|
||||||
@@ -19,9 +18,9 @@ class installedPackages(models.Model):
|
|||||||
class ApachePHP(models.Model):
|
class ApachePHP(models.Model):
|
||||||
phpVers = models.CharField(max_length=5, unique=True)
|
phpVers = models.CharField(max_length=5, unique=True)
|
||||||
|
|
||||||
|
|
||||||
class installedPackagesApache(models.Model):
|
class installedPackagesApache(models.Model):
|
||||||
phpVers = models.ForeignKey(ApachePHP, on_delete=models.CASCADE)
|
phpVers = models.ForeignKey(ApachePHP, on_delete=models.CASCADE)
|
||||||
extensionName = models.CharField(max_length=50)
|
extensionName = models.CharField(max_length=50)
|
||||||
description = models.CharField(max_length=255)
|
description = models.CharField(max_length=255)
|
||||||
status = models.IntegerField()
|
status = models.IntegerField()
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ from plogical.acl import ACLManager
|
|||||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class UserManager(multi.Thread):
|
class UserManager(multi.Thread):
|
||||||
|
|
||||||
def __init__(self, function, extraArgs):
|
def __init__(self, function, extraArgs):
|
||||||
@@ -18,7 +17,6 @@ class UserManager(multi.Thread):
|
|||||||
self.function = function
|
self.function = function
|
||||||
self.extraArgs = extraArgs
|
self.extraArgs = extraArgs
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
try:
|
try:
|
||||||
if self.function == 'controlUserState':
|
if self.function == 'controlUserState':
|
||||||
@@ -42,6 +40,5 @@ class UserManager(multi.Thread):
|
|||||||
data = {'websiteName': items, 'state': 'UN-Suspend'}
|
data = {'websiteName': items, 'state': 'UN-Suspend'}
|
||||||
wm.submitWebsiteStatus(self.extraArgs['user'].pk, data)
|
wm.submitWebsiteStatus(self.extraArgs['user'].pk, data)
|
||||||
|
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.writeToFile(str(msg) + '[Error:UserManager:32]')
|
logging.writeToFile(str(msg) + '[Error:UserManager:32]')
|
||||||
@@ -13,7 +13,6 @@ from plogical.virtualHostUtilities import virtualHostUtilities
|
|||||||
from CyberCP.secMiddleware import secMiddleware
|
from CyberCP.secMiddleware import secMiddleware
|
||||||
from CyberCP.SecurityLevel import SecurityLevel
|
from CyberCP.SecurityLevel import SecurityLevel
|
||||||
|
|
||||||
# Create your views here.
|
|
||||||
|
|
||||||
def loadUserHome(request):
|
def loadUserHome(request):
|
||||||
|
|
||||||
@@ -30,6 +29,7 @@ def loadUserHome(request):
|
|||||||
{"type": admin.type, 'listUsers': listUsers}, 'listUsers')
|
{"type": admin.type, 'listUsers': listUsers}, 'listUsers')
|
||||||
return proc.render()
|
return proc.render()
|
||||||
|
|
||||||
|
|
||||||
def viewProfile(request):
|
def viewProfile(request):
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
admin = Administrator.objects.get(pk=userID)
|
admin = Administrator.objects.get(pk=userID)
|
||||||
@@ -47,6 +47,7 @@ def viewProfile(request):
|
|||||||
AdminData)
|
AdminData)
|
||||||
return proc.render()
|
return proc.render()
|
||||||
|
|
||||||
|
|
||||||
def createUser(request):
|
def createUser(request):
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
@@ -69,6 +70,7 @@ def createUser(request):
|
|||||||
else:
|
else:
|
||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
|
|
||||||
def apiAccess(request):
|
def apiAccess(request):
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
@@ -78,6 +80,7 @@ def apiAccess(request):
|
|||||||
{'acctNames': adminNames}, 'admin')
|
{'acctNames': adminNames}, 'admin')
|
||||||
return proc.render()
|
return proc.render()
|
||||||
|
|
||||||
|
|
||||||
def saveChangesAPIAccess(request):
|
def saveChangesAPIAccess(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -109,6 +112,7 @@ def saveChangesAPIAccess(request):
|
|||||||
json_data = json.dumps(finalResponse)
|
json_data = json.dumps(finalResponse)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def submitUserCreation(request):
|
def submitUserCreation(request):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
@@ -122,7 +126,6 @@ def submitUserCreation(request):
|
|||||||
data = request
|
data = request
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
|
||||||
|
|
||||||
firstName = data['firstName']
|
firstName = data['firstName']
|
||||||
lastName = data['lastName']
|
lastName = data['lastName']
|
||||||
email = data['email']
|
email = data['email']
|
||||||
@@ -259,6 +262,7 @@ def modifyUsers(request):
|
|||||||
{"acctNames": userNames, 'securityLevels': SecurityLevel.list()})
|
{"acctNames": userNames, 'securityLevels': SecurityLevel.list()})
|
||||||
return proc.render()
|
return proc.render()
|
||||||
|
|
||||||
|
|
||||||
def fetchUserDetails(request):
|
def fetchUserDetails(request):
|
||||||
try:
|
try:
|
||||||
val = request.session['userID']
|
val = request.session['userID']
|
||||||
@@ -323,6 +327,7 @@ def fetchUserDetails(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def saveModifications(request):
|
def saveModifications(request):
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
@@ -394,7 +399,6 @@ def saveModifications(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
data_ret = {'status': 0, 'saveStatus': 0, 'error_message': str(msg)}
|
data_ret = {'status': 0, 'saveStatus': 0, 'error_message': str(msg)}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
@@ -405,6 +409,7 @@ def saveModifications(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def deleteUser(request):
|
def deleteUser(request):
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
@@ -422,6 +427,7 @@ def deleteUser(request):
|
|||||||
else:
|
else:
|
||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
|
|
||||||
def submitUserDeletion(request):
|
def submitUserDeletion(request):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -443,16 +449,13 @@ def submitUserDeletion(request):
|
|||||||
except:
|
except:
|
||||||
force = 0
|
force = 0
|
||||||
|
|
||||||
|
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
|
||||||
currentUser = Administrator.objects.get(pk=userID)
|
currentUser = Administrator.objects.get(pk=userID)
|
||||||
userInQuestion = Administrator.objects.get(userName=accountUsername)
|
userInQuestion = Administrator.objects.get(userName=accountUsername)
|
||||||
|
|
||||||
|
|
||||||
if ACLManager.checkUserOwnerShip(currentACL, currentUser, userInQuestion):
|
if ACLManager.checkUserOwnerShip(currentACL, currentUser, userInQuestion):
|
||||||
|
|
||||||
|
|
||||||
if force:
|
if force:
|
||||||
userACL = ACLManager.loadedACL(userInQuestion.pk)
|
userACL = ACLManager.loadedACL(userInQuestion.pk)
|
||||||
websitesName = ACLManager.findAllSites(userACL, userInQuestion.pk)
|
websitesName = ACLManager.findAllSites(userACL, userInQuestion.pk)
|
||||||
@@ -480,7 +483,6 @@ def submitUserDeletion(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
data_ret = {'status': 0, 'deleteStatus': 0, 'error_message': str(msg)}
|
data_ret = {'status': 0, 'deleteStatus': 0, 'error_message': str(msg)}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
@@ -491,11 +493,13 @@ def submitUserDeletion(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def createNewACL(request):
|
def createNewACL(request):
|
||||||
proc = httpProc(request, 'userManagment/createACL.html',
|
proc = httpProc(request, 'userManagment/createACL.html',
|
||||||
None, 'admin')
|
None, 'admin')
|
||||||
return proc.render()
|
return proc.render()
|
||||||
|
|
||||||
|
|
||||||
def createACLFunc(request):
|
def createACLFunc(request):
|
||||||
try:
|
try:
|
||||||
val = request.session['userID']
|
val = request.session['userID']
|
||||||
@@ -526,12 +530,14 @@ def createACLFunc(request):
|
|||||||
json_data = json.dumps(finalResponse)
|
json_data = json.dumps(finalResponse)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def deleteACL(request):
|
def deleteACL(request):
|
||||||
aclNames = ACLManager.findAllACLs()
|
aclNames = ACLManager.findAllACLs()
|
||||||
proc = httpProc(request, 'userManagment/deleteACL.html',
|
proc = httpProc(request, 'userManagment/deleteACL.html',
|
||||||
{'aclNames': aclNames}, 'admin')
|
{'aclNames': aclNames}, 'admin')
|
||||||
return proc.render()
|
return proc.render()
|
||||||
|
|
||||||
|
|
||||||
def deleteACLFunc(request):
|
def deleteACLFunc(request):
|
||||||
try:
|
try:
|
||||||
val = request.session['userID']
|
val = request.session['userID']
|
||||||
@@ -558,12 +564,14 @@ def deleteACLFunc(request):
|
|||||||
json_data = json.dumps(finalResponse)
|
json_data = json.dumps(finalResponse)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def modifyACL(request):
|
def modifyACL(request):
|
||||||
aclNames = ACLManager.findAllACLs()
|
aclNames = ACLManager.findAllACLs()
|
||||||
proc = httpProc(request, 'userManagment/modifyACL.html',
|
proc = httpProc(request, 'userManagment/modifyACL.html',
|
||||||
{'aclNames': aclNames}, 'admin')
|
{'aclNames': aclNames}, 'admin')
|
||||||
return proc.render()
|
return proc.render()
|
||||||
|
|
||||||
|
|
||||||
def fetchACLDetails(request):
|
def fetchACLDetails(request):
|
||||||
try:
|
try:
|
||||||
val = request.session['userID']
|
val = request.session['userID']
|
||||||
@@ -588,6 +596,7 @@ def fetchACLDetails(request):
|
|||||||
json_data = json.dumps(finalResponse)
|
json_data = json.dumps(finalResponse)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def submitACLModifications(request):
|
def submitACLModifications(request):
|
||||||
try:
|
try:
|
||||||
val = request.session['userID']
|
val = request.session['userID']
|
||||||
@@ -646,6 +655,7 @@ def changeUserACL(request):
|
|||||||
else:
|
else:
|
||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
|
|
||||||
def changeACLFunc(request):
|
def changeACLFunc(request):
|
||||||
try:
|
try:
|
||||||
val = request.session['userID']
|
val = request.session['userID']
|
||||||
@@ -686,6 +696,7 @@ def changeACLFunc(request):
|
|||||||
json_data = json.dumps(finalResponse)
|
json_data = json.dumps(finalResponse)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def resellerCenter(request):
|
def resellerCenter(request):
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
@@ -705,6 +716,7 @@ def resellerCenter(request):
|
|||||||
else:
|
else:
|
||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
|
|
||||||
def saveResellerChanges(request):
|
def saveResellerChanges(request):
|
||||||
try:
|
try:
|
||||||
val = request.session['userID']
|
val = request.session['userID']
|
||||||
@@ -761,6 +773,7 @@ def saveResellerChanges(request):
|
|||||||
json_data = json.dumps(finalResponse)
|
json_data = json.dumps(finalResponse)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def listUsers(request):
|
def listUsers(request):
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
@@ -827,7 +840,6 @@ def fetchTableUsers(request):
|
|||||||
items.save()
|
items.save()
|
||||||
owner = Administrator.objects.get(pk=1)
|
owner = Administrator.objects.get(pk=1)
|
||||||
|
|
||||||
|
|
||||||
dic = {'id': items.pk,
|
dic = {'id': items.pk,
|
||||||
'name': items.userName,
|
'name': items.userName,
|
||||||
'owner': owner.userName,
|
'owner': owner.userName,
|
||||||
@@ -851,6 +863,7 @@ def fetchTableUsers(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def controlUserState(request):
|
def controlUserState(request):
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
@@ -903,7 +916,6 @@ def controlUserState(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
data_ret = {'status': 0, 'saveStatus': 0, 'error_message': str(msg)}
|
data_ret = {'status': 0, 'saveStatus': 0, 'error_message': str(msg)}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
|
|||||||
Reference in New Issue
Block a user