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,123 +49,93 @@ 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)
|
phps = PHPManager.findPHPVersions()
|
||||||
phps = PHPManager.findPHPVersions()
|
|
||||||
|
|
||||||
Data = {'packageList': packagesName, "owernList": adminNames, 'phps': phps}
|
Data = {'packageList': packagesName, "owernList": adminNames, 'phps': phps}
|
||||||
proc = httpProc(request, 'websiteFunctions/createWebsite.html',
|
proc = httpProc(request, 'websiteFunctions/createWebsite.html',
|
||||||
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)
|
||||||
|
phps = PHPManager.findPHPVersions()
|
||||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
proc = httpProc(request, 'websiteFunctions/modifyWebsite.html',
|
||||||
phps = PHPManager.findPHPVersions()
|
{'websiteList': websitesName, 'phps': phps}, 'modifyWebsite')
|
||||||
proc = httpProc(request, 'websiteFunctions/modifyWebsite.html',
|
return proc.render()
|
||||||
{'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):
|
def deleteWebsite(self, request=None, userID=None, data=None):
|
||||||
try:
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||||
|
proc = httpProc(request, 'websiteFunctions/deleteWebsite.html',
|
||||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
{'websiteList': websitesName}, 'deleteWebsite')
|
||||||
proc = httpProc(request, 'websiteFunctions/deleteWebsite.html',
|
return proc.render()
|
||||||
{'websiteList': websitesName}, 'deleteWebsite')
|
|
||||||
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)
|
||||||
|
|
||||||
proc = httpProc(request, 'websiteFunctions/suspendWebsite.html',
|
proc = httpProc(request, 'websiteFunctions/suspendWebsite.html',
|
||||||
{'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)
|
adminNames = ACLManager.loadAllUsers(userID)
|
||||||
pagination = self.websitePagination(currentACL, userID)
|
packagesName = ACLManager.loadPackages(userID, currentACL)
|
||||||
adminNames = ACLManager.loadAllUsers(userID)
|
phps = PHPManager.findPHPVersions()
|
||||||
packagesName = ACLManager.loadPackages(userID, currentACL)
|
|
||||||
phps = PHPManager.findPHPVersions()
|
|
||||||
|
|
||||||
Data = {'packageList': packagesName, "owernList": adminNames, 'phps': phps}
|
Data = {'packageList': packagesName, "owernList": adminNames, 'phps': phps}
|
||||||
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)
|
||||||
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
if ACLManager.checkOwnership(request.GET.get('domain'), admin, currentACL) == 1:
|
||||||
admin = Administrator.objects.get(pk=userID)
|
pass
|
||||||
|
else:
|
||||||
|
return ACLManager.loadError()
|
||||||
|
|
||||||
if ACLManager.checkOwnership(request.GET.get('domain'), admin, currentACL) == 1:
|
proc = httpProc(request, 'websiteFunctions/listCron.html',
|
||||||
pass
|
{'domain': request.GET.get('domain')})
|
||||||
else:
|
return proc.render()
|
||||||
return ACLManager.loadError()
|
|
||||||
|
|
||||||
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):
|
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)
|
|
||||||
|
|
||||||
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
aliasManager = AliasManager(self.domain)
|
aliasManager = AliasManager(self.domain)
|
||||||
noAlias, finalAlisList = aliasManager.fetchAlisForDomains()
|
noAlias, finalAlisList = aliasManager.fetchAlisForDomains()
|
||||||
|
|
||||||
path = "/home/" + self.domain + "/public_html"
|
path = "/home/" + self.domain + "/public_html"
|
||||||
|
|
||||||
proc = httpProc(request, 'websiteFunctions/domainAlias.html', {
|
proc = httpProc(request, 'websiteFunctions/domainAlias.html', {
|
||||||
'masterDomain': self.domain,
|
'masterDomain': self.domain,
|
||||||
'aliases': finalAlisList,
|
'aliases': finalAlisList,
|
||||||
'path': path,
|
'path': path,
|
||||||
'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,19 +1737,16 @@ 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)
|
|
||||||
|
|
||||||
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
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,19 +1839,16 @@ 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)
|
|
||||||
|
|
||||||
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
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,63 +1895,59 @@ 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)
|
||||||
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
website = Websites.objects.get(domain=self.domain)
|
||||||
|
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
||||||
admin = Administrator.objects.get(pk=userID)
|
pass
|
||||||
website = Websites.objects.get(domain=self.domain)
|
else:
|
||||||
|
return ACLManager.loadErrorJson()
|
||||||
|
|
||||||
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
path = '/home/cyberpanel/' + self.domain + '.git'
|
||||||
pass
|
|
||||||
else:
|
|
||||||
return ACLManager.loadErrorJson()
|
|
||||||
|
|
||||||
path = '/home/cyberpanel/' + self.domain + '.git'
|
if os.path.exists(path):
|
||||||
|
ipFile = "/etc/cyberpanel/machineIP"
|
||||||
|
f = open(ipFile)
|
||||||
|
ipData = f.read()
|
||||||
|
ipAddress = ipData.split('\n', 1)[0]
|
||||||
|
|
||||||
if os.path.exists(path):
|
port = ProcessUtilities.fetchCurrentPort()
|
||||||
ipFile = "/etc/cyberpanel/machineIP"
|
|
||||||
f = open(ipFile)
|
|
||||||
ipData = f.read()
|
|
||||||
ipAddress = ipData.split('\n', 1)[0]
|
|
||||||
|
|
||||||
port = ProcessUtilities.fetchCurrentPort()
|
webhookURL = 'https://' + ipAddress + ':%s/websites/' % (port) + self.domain + '/gitNotify'
|
||||||
|
|
||||||
webhookURL = 'https://' + ipAddress + ':%s/websites/' % (port) + self.domain + '/gitNotify'
|
proc = httpProc(request, 'websiteFunctions/setupGit.html',
|
||||||
|
{'domainName': self.domain, 'installed': 1, 'webhookURL': webhookURL})
|
||||||
|
return proc.render()
|
||||||
|
else:
|
||||||
|
|
||||||
proc = httpProc(request, 'websiteFunctions/setupGit.html',
|
command = "ssh-keygen -f /home/%s/.ssh/%s -t rsa -N ''" % (self.domain, website.externalApp)
|
||||||
{'domainName': self.domain, 'installed': 1, 'webhookURL': webhookURL})
|
ProcessUtilities.executioner(command, website.externalApp)
|
||||||
return proc.render()
|
|
||||||
else:
|
|
||||||
|
|
||||||
command = "ssh-keygen -f /home/%s/.ssh/%s -t rsa -N ''" % (self.domain, website.externalApp)
|
###
|
||||||
ProcessUtilities.executioner(command, website.externalApp)
|
|
||||||
|
|
||||||
###
|
configContent = """Host github.com
|
||||||
|
|
||||||
configContent = """Host github.com
|
|
||||||
IdentityFile /home/%s/.ssh/%s
|
IdentityFile /home/%s/.ssh/%s
|
||||||
StrictHostKeyChecking no
|
StrictHostKeyChecking no
|
||||||
""" % (self.domain, website.externalApp)
|
""" % (self.domain, website.externalApp)
|
||||||
|
|
||||||
path = "/home/cyberpanel/config"
|
path = "/home/cyberpanel/config"
|
||||||
writeToFile = open(path, 'w')
|
writeToFile = open(path, 'w')
|
||||||
writeToFile.writelines(configContent)
|
writeToFile.writelines(configContent)
|
||||||
writeToFile.close()
|
writeToFile.close()
|
||||||
|
|
||||||
command = 'mv %s /home/%s/.ssh/config' % (path, self.domain)
|
command = 'mv %s /home/%s/.ssh/config' % (path, self.domain)
|
||||||
ProcessUtilities.executioner(command)
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
command = 'chown %s:%s /home/%s/.ssh/config' % (website.externalApp, website.externalApp, self.domain)
|
command = 'chown %s:%s /home/%s/.ssh/config' % (website.externalApp, website.externalApp, self.domain)
|
||||||
ProcessUtilities.executioner(command)
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
command = 'cat /home/%s/.ssh/%s.pub' % (self.domain, website.externalApp)
|
command = 'cat /home/%s/.ssh/%s.pub' % (self.domain, website.externalApp)
|
||||||
deploymentKey = ProcessUtilities.outputExecutioner(command, website.externalApp)
|
deploymentKey = ProcessUtilities.outputExecutioner(command, website.externalApp)
|
||||||
|
|
||||||
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,34 +2074,28 @@ 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)
|
|
||||||
|
|
||||||
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
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,19 +2145,16 @@ 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)
|
|
||||||
|
|
||||||
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
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,23 +2563,20 @@ 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)
|
|
||||||
|
|
||||||
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
website = Websites.objects.get(domain=self.domain)
|
website = Websites.objects.get(domain=self.domain)
|
||||||
externalApp = website.externalApp
|
externalApp = website.externalApp
|
||||||
|
|
||||||
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,23 +2618,20 @@ 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)
|
|
||||||
|
|
||||||
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
website = Websites.objects.get(domain=self.domain)
|
website = Websites.objects.get(domain=self.domain)
|
||||||
externalApp = website.externalApp
|
externalApp = website.externalApp
|
||||||
|
|
||||||
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,23 +2684,20 @@ 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)
|
|
||||||
|
|
||||||
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
website = Websites.objects.get(domain=self.domain)
|
website = Websites.objects.get(domain=self.domain)
|
||||||
externalApp = website.externalApp
|
externalApp = website.externalApp
|
||||||
|
|
||||||
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,43 +2776,39 @@ 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):
|
||||||
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
|
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
return ACLManager.loadError()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
website = Websites.objects.get(domain=self.domain)
|
||||||
admin = Administrator.objects.get(pk=userID)
|
folders = ['/home/%s/public_html' % (self.domain), '/home/%s' % (self.domain),
|
||||||
|
'/home/vmail/%s' % (self.domain)]
|
||||||
|
|
||||||
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
databases = website.databases_set.all()
|
||||||
pass
|
|
||||||
else:
|
|
||||||
return ACLManager.loadError()
|
|
||||||
|
|
||||||
try:
|
for database in databases:
|
||||||
website = Websites.objects.get(domain=self.domain)
|
basePath = '/var/lib/mysql/'
|
||||||
folders = ['/home/%s/public_html' % (self.domain), '/home/%s' % (self.domain), '/home/vmail/%s' % (self.domain)]
|
folders.append('%s%s' % (basePath, database.dbName))
|
||||||
|
except:
|
||||||
|
|
||||||
databases = website.databases_set.all()
|
self.childWebsite = ChildDomains.objects.get(domain=self.domain)
|
||||||
|
|
||||||
for database in databases:
|
folders = [self.childWebsite.path]
|
||||||
basePath = '/var/lib/mysql/'
|
|
||||||
folders.append('%s%s' % (basePath, database.dbName))
|
|
||||||
|
|
||||||
|
databases = self.childWebsite.master.databases_set.all()
|
||||||
|
|
||||||
except:
|
for database in databases:
|
||||||
|
basePath = '/var/lib/mysql/'
|
||||||
|
folders.append('%s%s' % (basePath, database.dbName))
|
||||||
|
|
||||||
self.childWebsite = ChildDomains.objects.get(domain=self.domain)
|
proc = httpProc(request, 'websiteFunctions/manageGIT.html',
|
||||||
|
{'domainName': self.domain, 'folders': folders})
|
||||||
folders = [self.childWebsite.path]
|
return proc.render()
|
||||||
|
|
||||||
databases = self.childWebsite.master.databases_set.all()
|
|
||||||
|
|
||||||
for database in databases:
|
|
||||||
basePath = '/var/lib/mysql/'
|
|
||||||
folders.append('%s%s' % (basePath, database.dbName))
|
|
||||||
|
|
||||||
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):
|
def folderCheck(self):
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user