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