From 7ae3856e32aec7fe1132649d7a91b5f3c1b0ebc6 Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Sun, 5 Jun 2022 12:46:02 +0500 Subject: [PATCH] bug fixes in wp manager --- .../templates/baseTemplate/index.html | 4 + plogical/acl.py | 13 ++ plogical/applicationInstaller.py | 55 ++++--- .../websiteFunctions/websiteFunctions.js | 26 ++- .../websiteFunctions/WPAddNewPlugin.html | 24 ++- .../websiteFunctions/WPConfigurePlugins.html | 2 +- .../templates/websiteFunctions/WPCreate.html | 4 +- .../websiteFunctions/WPEidtPlugin.html | 2 +- .../websiteFunctions/WPsiteHome.html | 2 +- .../websiteFunctions/WPsitesList.html | 6 +- websiteFunctions/website.py | 148 ++++++++++++------ 11 files changed, 187 insertions(+), 99 deletions(-) diff --git a/baseTemplate/templates/baseTemplate/index.html b/baseTemplate/templates/baseTemplate/index.html index f2d626a33..7e60963b5 100755 --- a/baseTemplate/templates/baseTemplate/index.html +++ b/baseTemplate/templates/baseTemplate/index.html @@ -275,6 +275,10 @@ {# #} {# #} {# #} + + + diff --git a/plogical/acl.py b/plogical/acl.py index 57902d456..ea3bd19ca 100644 --- a/plogical/acl.py +++ b/plogical/acl.py @@ -18,6 +18,7 @@ from shlex import split from .CyberCPLogFileWriter import CyberCPLogFileWriter as logging from dockerManager.models import Containers from re import compile + class ACLManager: @@ -917,4 +918,16 @@ class ACLManager: else: dic['dnsAsWhole'] = 0 + @staticmethod + def GetALLWPObjects(currentACL, userID): + from websiteFunctions.models import WPSites + + wpsites = WPSites.objects.none() + websites = ACLManager.findWebsiteObjects(currentACL, userID) + + for website in websites: + wpsites |= website.wpsites_set.all() + + return wpsites + diff --git a/plogical/applicationInstaller.py b/plogical/applicationInstaller.py index 7744f96ad..afc7ebe58 100755 --- a/plogical/applicationInstaller.py +++ b/plogical/applicationInstaller.py @@ -1689,30 +1689,39 @@ $parameters = array( DataToPass['mailDomain'] = 0 UserID = self.data['adminID'] - ab = WebsiteManager() - coreResult = ab.submitWebsiteCreation(UserID, DataToPass) - coreResult1 = json.loads((coreResult).content) - logging.writeToFile("Creating website result....%s"%coreResult1) - reutrntempath = coreResult1['tempStatusPath'] - while (1): - lastLine = open(reutrntempath, 'r').read() - logging.writeToFile("Error web creating lastline ....... %s" % lastLine) - if lastLine.find('[200]') > -1: - break - elif lastLine.find('[404]') > -1: - statusFile = open(currentTemp, 'w') - statusFile.writelines('Failed to Create Website: error: %s. [404]' % lastLine) - statusFile.close() - return 0 - else: - statusFile = open(currentTemp, 'w') - statusFile.writelines('Creating Website....,20') - statusFile.close() - time.sleep(2) + try: + website = Websites.objects.get(domain=DataToPass['domainName']) - statusFile = open(tempStatusPath, 'w') - statusFile.writelines('Installing WordPress....,30') - statusFile.close() + if ACLManager.checkOwnership(website.domain, self.extraArgs['adminID'], self.extraArgs['currentACL']) == 0: + statusFile = open(tempStatusPath, 'w') + statusFile.writelines('You dont own this site.[404]') + statusFile.close() + except: + + ab = WebsiteManager() + coreResult = ab.submitWebsiteCreation(UserID, DataToPass) + coreResult1 = json.loads((coreResult).content) + logging.writeToFile("Creating website result....%s"%coreResult1) + reutrntempath = coreResult1['tempStatusPath'] + while (1): + lastLine = open(reutrntempath, 'r').read() + logging.writeToFile("Error web creating lastline ....... %s" % lastLine) + if lastLine.find('[200]') > -1: + break + elif lastLine.find('[404]') > -1: + statusFile = open(currentTemp, 'w') + statusFile.writelines('Failed to Create Website: error: %s. [404]' % lastLine) + statusFile.close() + return 0 + else: + statusFile = open(currentTemp, 'w') + statusFile.writelines('Creating Website....,20') + statusFile.close() + time.sleep(2) + + statusFile = open(tempStatusPath, 'w') + statusFile.writelines('Installing WordPress....,30') + statusFile.close() logging.writeToFile("Pluginbucket ....... %s" % str(self.data['pluginbucket'])) diff --git a/websiteFunctions/static/websiteFunctions/websiteFunctions.js b/websiteFunctions/static/websiteFunctions/websiteFunctions.js index 990f951af..f0f238931 100755 --- a/websiteFunctions/static/websiteFunctions/websiteFunctions.js +++ b/websiteFunctions/static/websiteFunctions/websiteFunctions.js @@ -50,8 +50,10 @@ function FinalDeletePluginBuucket() { var SPVal; app.controller('WPAddNewPlugin', function ($scope, $http, $timeout, $window, $compile) { + $scope.webSiteCreationLoading = true; $scope.SearchPluginName = function (val) { + $scope.webSiteCreationLoading = false; SPVal = val; url = "/websites/SearchOnkeyupPlugin"; @@ -72,6 +74,7 @@ app.controller('WPAddNewPlugin', function ($scope, $http, $timeout, $window, $co function ListInitialDatas(response) { + $scope.webSiteCreationLoading = true; if (response.data.status === 1) { if (SPVal == 'add') { @@ -138,12 +141,19 @@ app.controller('WPAddNewPlugin', function ($scope, $http, $timeout, $window, $co function ListInitialDatas(response) { if (response.data.status === 1) { - alert("added.........."); + new PNotify({ + title: 'Success!', + text: 'Bucket created.', + type: 'success' + }); location.reload(); } else { - // $scope.errorMessage = response.data.error_message; - alert("Status not = 1: Error..." + response.data.error_message) + new PNotify({ + title: 'Error!', + text: response.data.error_message, + type: 'error' + }); } @@ -275,7 +285,7 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $ var adminEmail = $scope.adminEmail; var WPPassword = $scope.WPPassword; var WPVersions = $scope.WPVersions; - var pluginbucket = $('#pliginbucket').val(); + var pluginbucket = $scope.pluginbucket; var autoupdates = $scope.autoupdates; var pluginupdates = $scope.pluginupdates; var themeupdates = $scope.themeupdates; @@ -305,7 +315,7 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $ function ListInitialDatas(response) { - + $scope.webSiteCreationLoading = true; if (response.data.status === 1) { statusFile = response.data.tempStatusPath; getCreationStatus(); @@ -338,7 +348,6 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $ $scope.goBackDisable = true; $("#installProgress").css("width", "0%"); }; - function getCreationStatus() { url = "/websites/installWordpressStatus"; @@ -359,7 +368,6 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $ function ListInitialDatas(response) { - if (response.data.abort === 1) { if (response.data.installStatus === 1) { @@ -377,7 +385,8 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $ $scope.currentStatus = response.data.currentStatus; $timeout.cancel(); - } else { + } + else { $scope.webSiteCreationLoading = true; $scope.installationDetailsForm = true; @@ -396,6 +405,7 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $ } } else { + $scope.webSiteCreationLoading = false; $("#installProgress").css("width", response.data.installationProgress + "%"); $scope.installPercentage = response.data.installationProgress; $scope.currentStatus = response.data.currentStatus; diff --git a/websiteFunctions/templates/websiteFunctions/WPAddNewPlugin.html b/websiteFunctions/templates/websiteFunctions/WPAddNewPlugin.html index 924edeaa2..821af61d4 100644 --- a/websiteFunctions/templates/websiteFunctions/WPAddNewPlugin.html +++ b/websiteFunctions/templates/websiteFunctions/WPAddNewPlugin.html @@ -20,27 +20,25 @@
- + - + + + - - - - - - +

Selected Plugin

diff --git a/websiteFunctions/templates/websiteFunctions/WPConfigurePlugins.html b/websiteFunctions/templates/websiteFunctions/WPConfigurePlugins.html index 8ef3a1a19..b9225d2d5 100644 --- a/websiteFunctions/templates/websiteFunctions/WPConfigurePlugins.html +++ b/websiteFunctions/templates/websiteFunctions/WPConfigurePlugins.html @@ -1,6 +1,6 @@ {% extends "baseTemplate/index.html" %} {% load i18n %} -{% block title %}{% trans "plugin - CyberPanel" %}{% endblock %} +{% block title %}{% trans "Create Plugin Buckets - CyberPanel" %}{% endblock %} {% block content %} {% load static %} diff --git a/websiteFunctions/templates/websiteFunctions/WPCreate.html b/websiteFunctions/templates/websiteFunctions/WPCreate.html index 53ec0ce8d..86dd4f237 100644 --- a/websiteFunctions/templates/websiteFunctions/WPCreate.html +++ b/websiteFunctions/templates/websiteFunctions/WPCreate.html @@ -1,6 +1,6 @@ {% extends "baseTemplate/index.html" %} {% load i18n %} -{% block title %}{% trans "Create New WordPress - CyberPanel" %}{% endblock %} +{% block title %}{% trans "Deploy WordPress - CyberPanel" %}{% endblock %} {% block content %} {% load static %} @@ -106,7 +106,7 @@
- {% for wp in Plugins %} diff --git a/websiteFunctions/templates/websiteFunctions/WPEidtPlugin.html b/websiteFunctions/templates/websiteFunctions/WPEidtPlugin.html index c51ea822f..08341d99d 100644 --- a/websiteFunctions/templates/websiteFunctions/WPEidtPlugin.html +++ b/websiteFunctions/templates/websiteFunctions/WPEidtPlugin.html @@ -1,6 +1,6 @@ {% extends "baseTemplate/index.html" %} {% load i18n %} -{% block title %}{% trans "plugin - CyberPanel" %}{% endblock %} +{% block title %}{% trans "Edit Plugin Bucket - CyberPanel" %}{% endblock %} {% block content %} {% load static %} diff --git a/websiteFunctions/templates/websiteFunctions/WPsiteHome.html b/websiteFunctions/templates/websiteFunctions/WPsiteHome.html index 99455d8df..7394dc8d1 100644 --- a/websiteFunctions/templates/websiteFunctions/WPsiteHome.html +++ b/websiteFunctions/templates/websiteFunctions/WPsiteHome.html @@ -1,6 +1,6 @@ {% extends "baseTemplate/index.html" %} {% load i18n %} -{% block title %}{% trans "Worpress Manager - CyberPanel" %}{% endblock %} +{% block title %}{% trans "WordPress Manager - CyberPanel" %}{% endblock %} {% block content %} {% load static %} diff --git a/websiteFunctions/templates/websiteFunctions/WPsitesList.html b/websiteFunctions/templates/websiteFunctions/WPsitesList.html index 90c12e726..8b863ab68 100644 --- a/websiteFunctions/templates/websiteFunctions/WPsitesList.html +++ b/websiteFunctions/templates/websiteFunctions/WPsitesList.html @@ -1,6 +1,6 @@ {% extends "baseTemplate/index.html" %} {% load i18n %} -{% block title %}{% trans "WordPress List - CyberPanel" %}{% endblock %} +{% block title %}{% trans "WordPress Sites - CyberPanel" %}{% endblock %} {% block content %} {% load static %} @@ -150,7 +150,7 @@
diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index d4715a595..ac8b85fea 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -63,9 +63,7 @@ class WebsiteManager: currentACL = ACLManager.loadedACL(userID) adminNames = ACLManager.loadAllUsers(userID) packagesName = ACLManager.loadPackages(userID, currentACL) - phps = PHPManager.findPHPVersions() FinalVersions = [] - #logging.CyberCPLogFileWriter.writeToFile("jassssssssss...............") userobj = Administrator.objects.get(pk=userID) counter = 0 try: @@ -78,14 +76,11 @@ class WebsiteManager: if versions['current'] not in FinalVersions: FinalVersions.append(versions['current']) counter = counter + 1 - except: FinalVersions = ['5.6', '5.5.3', '5.5.2'] Plugins = wpplugins.objects.filter(owner=userobj) - # logging.CyberCPLogFileWriter.writeToFile("FinalVersions:%s"+str(FinalVersions)) - Data = {'packageList': packagesName, "owernList": adminNames, 'WPVersions': FinalVersions, 'Plugins': Plugins } proc = httpProc(request, 'websiteFunctions/WPCreate.html', Data, 'createWebsite') @@ -94,17 +89,18 @@ class WebsiteManager: def ListWPSites(self, request=None, userID=None, DeleteID=None): currentACL = ACLManager.loadedACL(userID) - userobj = Administrator.objects.get(pk=userID) - webobjs = Websites.objects.all() + admin = Administrator.objects.get(pk=userID) tata = {} tata['wp']=[] tata['wpsites']=[] - tata['wp'] = WPSites.objects.all() + tata['wp'] = ACLManager.GetALLWPObjects(currentACL, userID) try: if DeleteID != None: WPDelete = WPSites.objects.get(pk=DeleteID) - WPDelete.delete() + + if ACLManager.checkOwnership(WPDelete.owner.domain, admin, currentACL) == 1: + WPDelete.delete() except BaseException as msg: pass @@ -115,8 +111,6 @@ class WebsiteManager: 'url': sub.FinalURL }) - - proc = httpProc(request, 'websiteFunctions/WPsitesList.html', {"wpsite": tata['wpsites']}) return proc.render() @@ -125,6 +119,12 @@ class WebsiteManager: Data = {} currentACL = ACLManager.loadedACL(userID) WPobj = WPSites.objects.get(pk=WPid) + admin = Administrator.objects.get(pk=userID) + + if ACLManager.checkOwnership(WPobj.owner.domain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() Data['wpsite'] = WPobj @@ -132,11 +132,10 @@ class WebsiteManager: DeleteID = request.GET.get('DeleteID', None) if DeleteID != None: - wstagingDelete = WPStaging.objects.get(pk=DeleteID) + wstagingDelete = WPStaging.objects.get(pk=DeleteID, owner=WPobj) wstagingDelete.delete() except BaseException as msg: - da= str(msg) proc = httpProc(request, 'websiteFunctions/WPsiteHome.html', @@ -146,7 +145,14 @@ class WebsiteManager: def AutoLogin(self, request=None, userID=None): WPid = request.GET.get('id') + currentACL = ACLManager.loadedACL(userID) WPobj = WPSites.objects.get(pk=WPid) + admin = Administrator.objects.get(pk=userID) + + if ACLManager.checkOwnership(WPobj.owner.domain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() #php = VirtualHost.getPHPString(self.data['PHPVersion']) #FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php) @@ -176,27 +182,21 @@ class WebsiteManager: data, 'createWebsite') return proc.render() - - def ConfigurePlugins(self, request=None, userID=None, data=None): DataPass ={} currentACL = ACLManager.loadedACL(userID) - adminNames = ACLManager.loadAllUsers(userID) - packagesName = ACLManager.loadPackages(userID, currentACL) - phps = PHPManager.findPHPVersions() userobj = Administrator.objects.get(pk=userID) Selectedplugins = wpplugins.objects.filter(owner = userobj) #data['Selectedplugins'] = wpplugins.objects.filter(ProjectOwner=HostingCompany) - Data = {'packageList': packagesName, "owernList": adminNames, 'phps': phps, 'Selectedplugins' : Selectedplugins,} + Data = {'Selectedplugins' : Selectedplugins,} proc = httpProc(request, 'websiteFunctions/WPConfigurePlugins.html', Data, 'createWebsite') return proc.render() - def Addnewplugin(self, request=None, userID=None, data=None): currentACL = ACLManager.loadedACL(userID) adminNames = ACLManager.loadAllUsers(userID) @@ -233,7 +233,6 @@ class WebsiteManager: json_data = json.dumps(data_ret) return HttpResponse(json_data) - def AddNewpluginAjax(self, userID=None, data=None): try: currentACL = ACLManager.loadedACL(userID) @@ -260,7 +259,6 @@ class WebsiteManager: json_data = json.dumps(data_ret) return HttpResponse(json_data) - def EidtPlugin(self,request=None, userID=None, pluginbID=None): Data ={} currentACL = ACLManager.loadedACL(userID) @@ -275,7 +273,6 @@ class WebsiteManager: Data, 'createWebsite') return proc.render() - def deletesPlgin(self, userID=None, data=None,): try: currentACL = ACLManager.loadedACL(userID) @@ -304,7 +301,6 @@ class WebsiteManager: json_data = json.dumps(data_ret) return HttpResponse(json_data) - def Addplugineidt(self, userID=None, data=None,): try: currentACL = ACLManager.loadedACL(userID) @@ -343,7 +339,6 @@ class WebsiteManager: json_data = json.dumps(data_ret) return HttpResponse(json_data) - def modifyWebsite(self, request=None, userID=None, data=None): currentACL = ACLManager.loadedACL(userID) @@ -429,7 +424,6 @@ class WebsiteManager: }) return proc.render() - def FetchWPdata(self, userID=None, data=None): try: currentACL = ACLManager.loadedACL(userID) @@ -437,20 +431,23 @@ class WebsiteManager: WPManagerID = data['WPid'] wpsite = WPSites.objects.get(pk=WPManagerID) - path = wpsite.path + if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() + + path = wpsite.path Webobj= Websites.objects.get(pk=wpsite.owner_id) Vhuser = Webobj.externalApp PHPVersion = Webobj.phpSelection - php = ACLManager.getPHPString(PHPVersion) FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php) - command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp core version --skip-plugins --skip-themes --path=%s' % (Vhuser, FinalPHPPath, path) version = ProcessUtilities.outputExecutioner(command) @@ -506,7 +503,6 @@ class WebsiteManager: json_data = json.dumps(data_ret) return HttpResponse(json_data) - def GetCurrentPlugins(self, userID=None, data=None): try: @@ -515,6 +511,12 @@ class WebsiteManager: WPManagerID = data['WPid'] wpsite = WPSites.objects.get(pk=WPManagerID) + + if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() + path = wpsite.path Webobj= Websites.objects.get(pk=wpsite.owner_id) @@ -540,7 +542,6 @@ class WebsiteManager: json_data = json.dumps(data_ret) return HttpResponse(json_data) - def GetCurrentThemes(self, userID=None, data=None): try: @@ -549,6 +550,12 @@ class WebsiteManager: WPManagerID = data['WPid'] wpsite = WPSites.objects.get(pk=WPManagerID) + + if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() + path = wpsite.path Webobj= Websites.objects.get(pk=wpsite.owner_id) @@ -577,7 +584,6 @@ class WebsiteManager: json_data = json.dumps(data_ret) return HttpResponse(json_data) - def fetchstaging(self, userID=None, data=None): try: @@ -587,6 +593,10 @@ class WebsiteManager: WPManagerID = data['WPid'] wpsite = WPSites.objects.get(pk=WPManagerID) + if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() from plogical.phpUtilities import phpUtilities @@ -604,8 +614,6 @@ class WebsiteManager: json_data = json.dumps(data_ret) return HttpResponse(json_data) - - def SaveUpdateConfig(self, userID=None, data=None): try: @@ -619,6 +627,11 @@ class WebsiteManager: wpsite = WPSites.objects.get(pk=WPManagerID) + if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() + wpsite.AutoUpdates = AutomaticUpdates wpsite.PluginUpdates = Plugins wpsite.ThemeUpdates = Themes @@ -634,7 +647,6 @@ class WebsiteManager: json_data = json.dumps(data_ret) return HttpResponse(json_data) - def UpdatePlugins(self, userID=None, data=None): try: @@ -645,6 +657,12 @@ class WebsiteManager: plugin = data['plugin'] pluginarray = data['pluginarray'] wpsite = WPSites.objects.get(pk=WPManagerID) + + if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() + path = wpsite.path Webobj= Websites.objects.get(pk=wpsite.owner_id) @@ -679,7 +697,6 @@ class WebsiteManager: json_data = json.dumps(data_ret) return HttpResponse(json_data) - def UpdateThemes(self, userID=None, data=None): try: @@ -691,6 +708,12 @@ class WebsiteManager: Theme = data['Theme'] Themearray = data['Themearray'] wpsite = WPSites.objects.get(pk=WPManagerID) + + if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() + path = wpsite.path Webobj= Websites.objects.get(pk=wpsite.owner_id) @@ -731,8 +754,6 @@ class WebsiteManager: json_data = json.dumps(data_ret) return HttpResponse(json_data) - - def DeletePlugins(self, userID=None, data=None): try: @@ -743,6 +764,12 @@ class WebsiteManager: plugin = data['plugin'] pluginarray = data['pluginarray'] wpsite = WPSites.objects.get(pk=WPManagerID) + + if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() + path = wpsite.path Webobj= Websites.objects.get(pk=wpsite.owner_id) @@ -776,7 +803,6 @@ class WebsiteManager: json_data = json.dumps(data_ret) return HttpResponse(json_data) - def DeleteThemes(self, userID=None, data=None): try: @@ -791,6 +817,11 @@ class WebsiteManager: Webobj= Websites.objects.get(pk=wpsite.owner_id) + if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() + Vhuser = Webobj.externalApp PHPVersion = Webobj.phpSelection php = ACLManager.getPHPString(PHPVersion) @@ -822,7 +853,6 @@ class WebsiteManager: json_data = json.dumps(data_ret) return HttpResponse(json_data) - def ChangeStatus(self, userID=None, data=None): try: @@ -832,6 +862,12 @@ class WebsiteManager: WPManagerID = data['WPid'] plugin = data['plugin'] wpsite = WPSites.objects.get(pk=WPManagerID) + + if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() + path = wpsite.path Webobj= Websites.objects.get(pk=wpsite.owner_id) @@ -868,7 +904,6 @@ class WebsiteManager: json_data = json.dumps(data_ret) return HttpResponse(json_data) - def ChangeStatusThemes(self, userID=None, data=None): try: # logging.CyberCPLogFileWriter.writeToFile("Error WP ChangeStatusThemes ....... %s") @@ -878,6 +913,12 @@ class WebsiteManager: WPManagerID = data['WPid'] Theme = data['theme'] wpsite = WPSites.objects.get(pk=WPManagerID) + + if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() + path = wpsite.path Webobj= Websites.objects.get(pk=wpsite.owner_id) @@ -914,7 +955,6 @@ class WebsiteManager: json_data = json.dumps(data_ret) return HttpResponse(json_data) - def CreateStagingNow(self, userID=None, data=None): try: currentACL = ACLManager.loadedACL(userID) @@ -927,6 +967,13 @@ class WebsiteManager: extraArgs['WPid'] = data['WPid'] extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999)) + wpsite = WPSites.objects.get(pk=data['WPid']) + + if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() + background = ApplicationInstaller('CreateStagingNow', extraArgs) background.start() @@ -943,9 +990,6 @@ class WebsiteManager: json_data = json.dumps(data_ret) return HttpResponse(json_data) - - - def UpdateWPSettings(self, userID=None, data=None): try: @@ -956,6 +1000,12 @@ class WebsiteManager: setting = data['setting'] settingValue = data['settingValue'] wpsite = WPSites.objects.get(pk=WPManagerID) + + if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() + path = wpsite.path Webobj= Websites.objects.get(pk=wpsite.owner_id) @@ -1047,18 +1097,22 @@ class WebsiteManager: json_data = json.dumps(data_ret) return HttpResponse(json_data) - def submitWorpressCreation(self, userID=None, data=None): try: currentACL = ACLManager.loadedACL(userID) admin = Administrator.objects.get(pk=userID) extraArgs = {} + extraArgs['currentACL'] = currentACL extraArgs['adminID'] = admin.pk extraArgs['domainName'] = data['domain'] extraArgs['WPVersion'] = data['WPVersion'] extraArgs['blogTitle'] = data['title'] - extraArgs['pluginbucket'] = data['pluginbucket'] + try: + extraArgs['pluginbucket'] = data['pluginbucket'] + except: + extraArgs['pluginbucket'] = '-1' + extraArgs['adminUser'] = data['adminUser'] extraArgs['PasswordByPass'] = data['PasswordByPass'] extraArgs['adminPassword'] = data['PasswordByPass']