mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 06:16:08 +01:00
further refoctor default render websiteFunctions
This commit is contained in:
@@ -28,9 +28,6 @@ from plogical.childDomain import ChildDomainManager
|
|||||||
from math import ceil
|
from math import ceil
|
||||||
from plogical.alias import AliasManager
|
from plogical.alias import AliasManager
|
||||||
from plogical.applicationInstaller import ApplicationInstaller
|
from plogical.applicationInstaller import ApplicationInstaller
|
||||||
from databases.models import Databases
|
|
||||||
import hashlib
|
|
||||||
from plogical.mysqlUtilities import mysqlUtilities
|
|
||||||
from plogical import hashPassword
|
from plogical import hashPassword
|
||||||
from emailMarketing.emACL import emACL
|
from emailMarketing.emACL import emACL
|
||||||
from plogical.processUtilities import ProcessUtilities
|
from plogical.processUtilities import ProcessUtilities
|
||||||
@@ -38,7 +35,6 @@ from managePHP.phpManager import PHPManager
|
|||||||
from ApachController.ApacheVhosts import ApacheVhost
|
from ApachController.ApacheVhosts import ApacheVhost
|
||||||
from plogical.vhostConfs import vhostConfs
|
from plogical.vhostConfs import vhostConfs
|
||||||
from plogical.cronUtil import CronUtil
|
from plogical.cronUtil import CronUtil
|
||||||
from plogical import randomPassword
|
|
||||||
from .StagingSetup import StagingSetup
|
from .StagingSetup import StagingSetup
|
||||||
import validators
|
import validators
|
||||||
|
|
||||||
@@ -53,7 +49,6 @@ class WebsiteManager:
|
|||||||
self.childDomain = childDomain
|
self.childDomain = childDomain
|
||||||
|
|
||||||
def createWebsite(self, request=None, userID=None, data=None):
|
def createWebsite(self, request=None, userID=None, data=None):
|
||||||
try:
|
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
adminNames = ACLManager.loadAllUsers(userID)
|
adminNames = ACLManager.loadAllUsers(userID)
|
||||||
packagesName = ACLManager.loadPackages(userID, currentACL)
|
packagesName = ACLManager.loadPackages(userID, currentACL)
|
||||||
@@ -64,12 +59,7 @@ class WebsiteManager:
|
|||||||
Data, 'createWebsite')
|
Data, 'createWebsite')
|
||||||
return proc.render()
|
return proc.render()
|
||||||
|
|
||||||
except BaseException as msg:
|
|
||||||
return HttpResponse(str(msg))
|
|
||||||
|
|
||||||
def modifyWebsite(self, request=None, userID=None, data=None):
|
def modifyWebsite(self, request=None, userID=None, data=None):
|
||||||
try:
|
|
||||||
|
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
|
||||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||||
@@ -77,22 +67,15 @@ class WebsiteManager:
|
|||||||
proc = httpProc(request, 'websiteFunctions/modifyWebsite.html',
|
proc = httpProc(request, 'websiteFunctions/modifyWebsite.html',
|
||||||
{'websiteList': websitesName, 'phps': phps}, 'modifyWebsite')
|
{'websiteList': websitesName, 'phps': phps}, 'modifyWebsite')
|
||||||
return proc.render()
|
return proc.render()
|
||||||
except BaseException as msg:
|
|
||||||
return HttpResponse(str(msg))
|
|
||||||
|
|
||||||
def deleteWebsite(self, request=None, userID=None, data=None):
|
def deleteWebsite(self, request=None, userID=None, data=None):
|
||||||
try:
|
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
|
||||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||||
proc = httpProc(request, 'websiteFunctions/deleteWebsite.html',
|
proc = httpProc(request, 'websiteFunctions/deleteWebsite.html',
|
||||||
{'websiteList': websitesName}, 'deleteWebsite')
|
{'websiteList': websitesName}, 'deleteWebsite')
|
||||||
return proc.render()
|
return proc.render()
|
||||||
except BaseException as msg:
|
|
||||||
return HttpResponse(str(msg))
|
|
||||||
|
|
||||||
def siteState(self, request=None, userID=None, data=None):
|
def siteState(self, request=None, userID=None, data=None):
|
||||||
try:
|
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
|
||||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||||
@@ -101,23 +84,15 @@ class WebsiteManager:
|
|||||||
{'websiteList': websitesName}, 'suspendWebsite')
|
{'websiteList': websitesName}, 'suspendWebsite')
|
||||||
return proc.render()
|
return proc.render()
|
||||||
|
|
||||||
except BaseException as msg:
|
|
||||||
return HttpResponse(str(msg))
|
|
||||||
|
|
||||||
def listWebsites(self, request=None, userID=None, data=None):
|
def listWebsites(self, request=None, userID=None, data=None):
|
||||||
try:
|
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
pagination = self.websitePagination(currentACL, userID)
|
pagination = self.websitePagination(currentACL, userID)
|
||||||
proc = httpProc(request, 'websiteFunctions/listWebsites.html',
|
proc = httpProc(request, 'websiteFunctions/listWebsites.html',
|
||||||
{"pagination": pagination})
|
{"pagination": pagination})
|
||||||
return proc.render()
|
return proc.render()
|
||||||
except BaseException as msg:
|
|
||||||
return HttpResponse(str(msg))
|
|
||||||
|
|
||||||
def listChildDomains(self, request=None, userID=None, data=None):
|
def listChildDomains(self, request=None, userID=None, data=None):
|
||||||
try:
|
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
pagination = self.websitePagination(currentACL, userID)
|
|
||||||
adminNames = ACLManager.loadAllUsers(userID)
|
adminNames = ACLManager.loadAllUsers(userID)
|
||||||
packagesName = ACLManager.loadPackages(userID, currentACL)
|
packagesName = ACLManager.loadPackages(userID, currentACL)
|
||||||
phps = PHPManager.findPHPVersions()
|
phps = PHPManager.findPHPVersions()
|
||||||
@@ -126,12 +101,8 @@ class WebsiteManager:
|
|||||||
proc = httpProc(request, 'websiteFunctions/listChildDomains.html',
|
proc = httpProc(request, 'websiteFunctions/listChildDomains.html',
|
||||||
Data)
|
Data)
|
||||||
return proc.render()
|
return proc.render()
|
||||||
except BaseException as msg:
|
|
||||||
return HttpResponse(str(msg))
|
|
||||||
|
|
||||||
def listCron(self, request=None, userID=None, data=None):
|
def listCron(self, request=None, userID=None, data=None):
|
||||||
try:
|
|
||||||
|
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
admin = Administrator.objects.get(pk=userID)
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
@@ -143,11 +114,8 @@ class WebsiteManager:
|
|||||||
proc = httpProc(request, 'websiteFunctions/listCron.html',
|
proc = httpProc(request, 'websiteFunctions/listCron.html',
|
||||||
{'domain': request.GET.get('domain')})
|
{'domain': request.GET.get('domain')})
|
||||||
return proc.render()
|
return proc.render()
|
||||||
except BaseException as msg:
|
|
||||||
return HttpResponse(str(msg))
|
|
||||||
|
|
||||||
def domainAlias(self, request=None, userID=None, data=None):
|
def domainAlias(self, request=None, userID=None, data=None):
|
||||||
try:
|
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
admin = Administrator.objects.get(pk=userID)
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
@@ -168,8 +136,6 @@ class WebsiteManager:
|
|||||||
'noAlias': noAlias
|
'noAlias': noAlias
|
||||||
})
|
})
|
||||||
return proc.render()
|
return proc.render()
|
||||||
except BaseException as msg:
|
|
||||||
return HttpResponse(str(msg))
|
|
||||||
|
|
||||||
def submitWebsiteCreation(self, userID=None, data=None):
|
def submitWebsiteCreation(self, userID=None, data=None):
|
||||||
try:
|
try:
|
||||||
@@ -986,6 +952,7 @@ class WebsiteManager:
|
|||||||
proc = httpProc(request, 'websiteFunctions/launchChild.html',
|
proc = httpProc(request, 'websiteFunctions/launchChild.html',
|
||||||
{"error": 1, "domain": "This child domain does not exists"})
|
{"error": 1, "domain": "This child domain does not exists"})
|
||||||
return proc.render()
|
return proc.render()
|
||||||
|
|
||||||
def getDataFromLogFile(self, userID=None, data=None):
|
def getDataFromLogFile(self, userID=None, data=None):
|
||||||
|
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
@@ -1770,7 +1737,6 @@ class WebsiteManager:
|
|||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
def wordpressInstall(self, request=None, userID=None, data=None):
|
def wordpressInstall(self, request=None, userID=None, data=None):
|
||||||
try:
|
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
admin = Administrator.objects.get(pk=userID)
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
@@ -1781,8 +1747,6 @@ class WebsiteManager:
|
|||||||
|
|
||||||
proc = httpProc(request, 'websiteFunctions/installWordPress.html', {'domainName': self.domain})
|
proc = httpProc(request, 'websiteFunctions/installWordPress.html', {'domainName': self.domain})
|
||||||
return proc.render()
|
return proc.render()
|
||||||
except BaseException as msg:
|
|
||||||
return HttpResponse(str(msg))
|
|
||||||
|
|
||||||
def installWordpress(self, userID=None, data=None):
|
def installWordpress(self, userID=None, data=None):
|
||||||
try:
|
try:
|
||||||
@@ -1875,7 +1839,6 @@ class WebsiteManager:
|
|||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
def joomlaInstall(self, request=None, userID=None, data=None):
|
def joomlaInstall(self, request=None, userID=None, data=None):
|
||||||
try:
|
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
admin = Administrator.objects.get(pk=userID)
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
@@ -1886,8 +1849,6 @@ class WebsiteManager:
|
|||||||
|
|
||||||
proc = httpProc(request, 'websiteFunctions/installJoomla.html', {'domainName': self.domain})
|
proc = httpProc(request, 'websiteFunctions/installJoomla.html', {'domainName': self.domain})
|
||||||
return proc.render()
|
return proc.render()
|
||||||
except BaseException as msg:
|
|
||||||
return HttpResponse(str(msg))
|
|
||||||
|
|
||||||
def installJoomla(self, userID=None, data=None):
|
def installJoomla(self, userID=None, data=None):
|
||||||
try:
|
try:
|
||||||
@@ -1934,8 +1895,6 @@ class WebsiteManager:
|
|||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
def setupGit(self, request=None, userID=None, data=None):
|
def setupGit(self, request=None, userID=None, data=None):
|
||||||
try:
|
|
||||||
|
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
admin = Administrator.objects.get(pk=userID)
|
admin = Administrator.objects.get(pk=userID)
|
||||||
website = Websites.objects.get(domain=self.domain)
|
website = Websites.objects.get(domain=self.domain)
|
||||||
@@ -1989,8 +1948,6 @@ StrictHostKeyChecking no
|
|||||||
proc = httpProc(request, 'websiteFunctions/setupGit.html',
|
proc = httpProc(request, 'websiteFunctions/setupGit.html',
|
||||||
{'domainName': self.domain, 'deploymentKey': deploymentKey, 'installed': 0})
|
{'domainName': self.domain, 'deploymentKey': deploymentKey, 'installed': 0})
|
||||||
return proc.render()
|
return proc.render()
|
||||||
except BaseException as msg:
|
|
||||||
return HttpResponse(str(msg))
|
|
||||||
|
|
||||||
def setupGitRepo(self, userID=None, data=None):
|
def setupGitRepo(self, userID=None, data=None):
|
||||||
try:
|
try:
|
||||||
@@ -2117,7 +2074,6 @@ StrictHostKeyChecking no
|
|||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
def installPrestaShop(self, request=None, userID=None, data=None):
|
def installPrestaShop(self, request=None, userID=None, data=None):
|
||||||
try:
|
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
admin = Administrator.objects.get(pk=userID)
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
@@ -2128,11 +2084,8 @@ StrictHostKeyChecking no
|
|||||||
|
|
||||||
proc = httpProc(request, 'websiteFunctions/installPrestaShop.html', {'domainName': self.domain})
|
proc = httpProc(request, 'websiteFunctions/installPrestaShop.html', {'domainName': self.domain})
|
||||||
return proc.render()
|
return proc.render()
|
||||||
except BaseException as msg:
|
|
||||||
return HttpResponse(str(msg))
|
|
||||||
|
|
||||||
def installMagento(self, request=None, userID=None, data=None):
|
def installMagento(self, request=None, userID=None, data=None):
|
||||||
try:
|
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
admin = Administrator.objects.get(pk=userID)
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
@@ -2143,8 +2096,6 @@ StrictHostKeyChecking no
|
|||||||
|
|
||||||
proc = httpProc(request, 'websiteFunctions/installMagento.html', {'domainName': self.domain})
|
proc = httpProc(request, 'websiteFunctions/installMagento.html', {'domainName': self.domain})
|
||||||
return proc.render()
|
return proc.render()
|
||||||
except BaseException as msg:
|
|
||||||
return HttpResponse(str(msg))
|
|
||||||
|
|
||||||
def magentoInstall(self, userID=None, data=None):
|
def magentoInstall(self, userID=None, data=None):
|
||||||
try:
|
try:
|
||||||
@@ -2194,7 +2145,6 @@ StrictHostKeyChecking no
|
|||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
def installMautic(self, request=None, userID=None, data=None):
|
def installMautic(self, request=None, userID=None, data=None):
|
||||||
try:
|
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
admin = Administrator.objects.get(pk=userID)
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
@@ -2205,8 +2155,6 @@ StrictHostKeyChecking no
|
|||||||
|
|
||||||
proc = httpProc(request, 'websiteFunctions/installMautic.html', {'domainName': self.domain})
|
proc = httpProc(request, 'websiteFunctions/installMautic.html', {'domainName': self.domain})
|
||||||
return proc.render()
|
return proc.render()
|
||||||
except BaseException as msg:
|
|
||||||
return HttpResponse(str(msg))
|
|
||||||
|
|
||||||
def mauticInstall(self, userID=None, data=None):
|
def mauticInstall(self, userID=None, data=None):
|
||||||
try:
|
try:
|
||||||
@@ -2615,7 +2563,6 @@ StrictHostKeyChecking no
|
|||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
def sshAccess(self, request=None, userID=None, data=None):
|
def sshAccess(self, request=None, userID=None, data=None):
|
||||||
try:
|
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
admin = Administrator.objects.get(pk=userID)
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
@@ -2630,8 +2577,6 @@ StrictHostKeyChecking no
|
|||||||
proc = httpProc(request, 'websiteFunctions/sshAccess.html',
|
proc = httpProc(request, 'websiteFunctions/sshAccess.html',
|
||||||
{'domainName': self.domain, 'externalApp': externalApp})
|
{'domainName': self.domain, 'externalApp': externalApp})
|
||||||
return proc.render()
|
return proc.render()
|
||||||
except BaseException as msg:
|
|
||||||
return HttpResponse(str(msg))
|
|
||||||
|
|
||||||
def saveSSHAccessChanges(self, userID=None, data=None):
|
def saveSSHAccessChanges(self, userID=None, data=None):
|
||||||
try:
|
try:
|
||||||
@@ -2673,7 +2618,6 @@ StrictHostKeyChecking no
|
|||||||
|
|
||||||
|
|
||||||
def setupStaging(self, request=None, userID=None, data=None):
|
def setupStaging(self, request=None, userID=None, data=None):
|
||||||
try:
|
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
admin = Administrator.objects.get(pk=userID)
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
@@ -2688,8 +2632,6 @@ StrictHostKeyChecking no
|
|||||||
proc = httpProc(request, 'websiteFunctions/setupStaging.html',
|
proc = httpProc(request, 'websiteFunctions/setupStaging.html',
|
||||||
{'domainName': self.domain, 'externalApp': externalApp})
|
{'domainName': self.domain, 'externalApp': externalApp})
|
||||||
return proc.render()
|
return proc.render()
|
||||||
except BaseException as msg:
|
|
||||||
return HttpResponse(str(msg))
|
|
||||||
|
|
||||||
def startCloning(self, userID=None, data=None):
|
def startCloning(self, userID=None, data=None):
|
||||||
try:
|
try:
|
||||||
@@ -2742,7 +2684,6 @@ StrictHostKeyChecking no
|
|||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
def syncToMaster(self, request=None, userID=None, data=None, childDomain = None):
|
def syncToMaster(self, request=None, userID=None, data=None, childDomain = None):
|
||||||
try:
|
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
admin = Administrator.objects.get(pk=userID)
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
@@ -2757,8 +2698,6 @@ StrictHostKeyChecking no
|
|||||||
proc = httpProc(request, 'websiteFunctions/syncMaster.html',
|
proc = httpProc(request, 'websiteFunctions/syncMaster.html',
|
||||||
{'domainName': self.domain, 'externalApp': externalApp, 'childDomain': childDomain})
|
{'domainName': self.domain, 'externalApp': externalApp, 'childDomain': childDomain})
|
||||||
return proc.render()
|
return proc.render()
|
||||||
except BaseException as msg:
|
|
||||||
return HttpResponse(str(msg))
|
|
||||||
|
|
||||||
def startSync(self, userID=None, data=None):
|
def startSync(self, userID=None, data=None):
|
||||||
try:
|
try:
|
||||||
@@ -2837,7 +2776,6 @@ StrictHostKeyChecking no
|
|||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
def manageGIT(self, request=None, userID=None, data=None):
|
def manageGIT(self, request=None, userID=None, data=None):
|
||||||
try:
|
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
admin = Administrator.objects.get(pk=userID)
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
@@ -2848,15 +2786,14 @@ StrictHostKeyChecking no
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
website = Websites.objects.get(domain=self.domain)
|
website = Websites.objects.get(domain=self.domain)
|
||||||
folders = ['/home/%s/public_html' % (self.domain), '/home/%s' % (self.domain), '/home/vmail/%s' % (self.domain)]
|
folders = ['/home/%s/public_html' % (self.domain), '/home/%s' % (self.domain),
|
||||||
|
'/home/vmail/%s' % (self.domain)]
|
||||||
|
|
||||||
databases = website.databases_set.all()
|
databases = website.databases_set.all()
|
||||||
|
|
||||||
for database in databases:
|
for database in databases:
|
||||||
basePath = '/var/lib/mysql/'
|
basePath = '/var/lib/mysql/'
|
||||||
folders.append('%s%s' % (basePath, database.dbName))
|
folders.append('%s%s' % (basePath, database.dbName))
|
||||||
|
|
||||||
|
|
||||||
except:
|
except:
|
||||||
|
|
||||||
self.childWebsite = ChildDomains.objects.get(domain=self.domain)
|
self.childWebsite = ChildDomains.objects.get(domain=self.domain)
|
||||||
@@ -2872,8 +2809,6 @@ StrictHostKeyChecking no
|
|||||||
proc = httpProc(request, 'websiteFunctions/manageGIT.html',
|
proc = httpProc(request, 'websiteFunctions/manageGIT.html',
|
||||||
{'domainName': self.domain, 'folders': folders})
|
{'domainName': self.domain, 'folders': folders})
|
||||||
return proc.render()
|
return proc.render()
|
||||||
except BaseException as msg:
|
|
||||||
return HttpResponse(str(msg))
|
|
||||||
|
|
||||||
def folderCheck(self):
|
def folderCheck(self):
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user