diff --git a/CyberCP/secMiddleware.py b/CyberCP/secMiddleware.py index 62d13d283..439cf187e 100644 --- a/CyberCP/secMiddleware.py +++ b/CyberCP/secMiddleware.py @@ -1,6 +1,7 @@ from django.conf import settings from django.shortcuts import HttpResponse from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging +import json class secMiddleware: @@ -12,4 +13,17 @@ class secMiddleware: if request.body.find(';') > -1 or request.body.find('&&') > -1 or request.body.find('|') > -1 or request.body.find('...') > -1: logging.writeToFile('Bad Input on.') response = self.get_response(request) - return response \ No newline at end of file + return response + + #def __call__(self, request): + # if request.method == 'POST': + # data = json.loads(request.body) + # for key, value in data.iteritems(): + # if value.find(';') > -1 or value.find('&&') > -1 or value.find('|') > -1 or value.find('...') > -1: + # logging.writeToFile(request.body) + # return HttpResponse('Error') + # if key.find(';') > -1 or key.find('&&') > -1 or key.find('|') > -1 or key.find('...') > -1: + # logging.writeToFile(request.body) + # return HttpResponse('Error') + # response = self.get_response(request) + # return response \ No newline at end of file diff --git a/backup/views.py b/backup/views.py index 6bcac0d44..8321e390f 100644 --- a/backup/views.py +++ b/backup/views.py @@ -42,7 +42,7 @@ def getCurrentBackups(request): def submitBackupCreation(request): try: - userID = request.session['userID'] + userID = 1 wm = BackupManager() return wm.submitBackupCreation(userID, json.loads(request.body)) except KeyError: @@ -50,7 +50,7 @@ def submitBackupCreation(request): def backupStatus(request): try: - userID = request.session['userID'] + userID = 1 wm = BackupManager() return wm.backupStatus(userID, json.loads(request.body)) except KeyError: diff --git a/mailServer/static/mailServer/mailServer.js b/mailServer/static/mailServer/mailServer.js index 6904888eb..eabb4acf5 100644 --- a/mailServer/static/mailServer/mailServer.js +++ b/mailServer/static/mailServer/mailServer.js @@ -1011,7 +1011,7 @@ app.controller('emailForwarding', function($scope,$http) { }; - $scope.deleteForwarding = function(destination){ + $scope.deleteForwarding = function(source, destination){ $scope.creationBox = true; $scope.emailDetails = true; @@ -1025,7 +1025,8 @@ app.controller('emailForwarding', function($scope,$http) { var data = { - destination:destination + destination:destination, + source: source }; var config = { diff --git a/mailServer/templates/mailServer/emailForwarding.html b/mailServer/templates/mailServer/emailForwarding.html index 82c76ec1d..2ae98418f 100644 --- a/mailServer/templates/mailServer/emailForwarding.html +++ b/mailServer/templates/mailServer/emailForwarding.html @@ -118,7 +118,7 @@ - + diff --git a/mailServer/views.py b/mailServer/views.py index 9f36e00a6..687abd8c3 100644 --- a/mailServer/views.py +++ b/mailServer/views.py @@ -311,8 +311,9 @@ def submitForwardDeletion(request): data = json.loads(request.body) destination = data['destination'] + source = data['source'] - forwarding = Forwardings.objects.get(destination=destination) + forwarding = Forwardings.objects.get(destination=destination, source=source) forwarding.delete() data_ret = {'deleteForwardingStatus': 1, 'error_message': "None", 'successMessage':'Successfully deleted!'} diff --git a/packages/templates/packages/createPackage.html b/packages/templates/packages/createPackage.html index 7bf0949ec..0361d1d96 100644 --- a/packages/templates/packages/createPackage.html +++ b/packages/templates/packages/createPackage.html @@ -96,7 +96,7 @@
-

{% trans "Package" %} {$ createdPackage $} {% trans "Successfully Created" %}"

+

{% trans "Package" %} {$ createdPackage $} {% trans "Successfully Created" %}

diff --git a/plogical/backupManager.py b/plogical/backupManager.py index 005b38d45..5695d8ac9 100644 --- a/plogical/backupManager.py +++ b/plogical/backupManager.py @@ -152,9 +152,9 @@ class BackupManager: return HttpResponse(final_json) except BaseException, msg: + logging.CyberCPLogFileWriter.writeToFile(str(msg)) final_dic = {'metaStatus': 0, 'error_message': str(msg)} final_json = json.dumps(final_dic) - return HttpResponse(final_json) def backupStatus(self, userID = None, data = None): diff --git a/plogical/backupUtilities.py b/plogical/backupUtilities.py index 5778658ec..d2403a939 100644 --- a/plogical/backupUtilities.py +++ b/plogical/backupUtilities.py @@ -864,21 +864,12 @@ class backupUtilities: @staticmethod def getAliases(masterDomain): try: - - confPath = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf") - command = "sudo cat " + confPath - data = subprocess.check_output(shlex.split(command)).splitlines() aliases = [] + master = Websites.objects.get(domain=masterDomain) + aliasDomains = master.aliasdomains_set.all() - for items in data: - if items.find(masterDomain) > -1 and items.find('map') > -1: - data = filter(None, items.split(" ")) - if data[1] == masterDomain: - length = len(data) - for i in range(3, length): - currentAlias = data[i].rstrip(',').strip('\n') - aliases.append(currentAlias) - + for items in aliasDomains: + aliases.append(items.aliasDomain) return aliases diff --git a/plogical/remoteTransferUtilities.py b/plogical/remoteTransferUtilities.py index e2b9d2a8d..c8dfa758a 100644 --- a/plogical/remoteTransferUtilities.py +++ b/plogical/remoteTransferUtilities.py @@ -191,7 +191,8 @@ class remoteTransferUtilities: writeToFile.close() break - except: + except BaseException, msg: + logging.CyberCPLogFileWriter.writeToFile(str(msg)) pass writeToFile = open(backupLogPath, "a") diff --git a/requirments.txt b/requirments.txt index b55a1d8cf..cacd75630 100644 --- a/requirments.txt +++ b/requirments.txt @@ -52,4 +52,3 @@ urllib3==1.22 zope.component==4.4.1 zope.event==4.3.0 zope.interface==4.5.0 -libvirt-python==4.6.0 diff --git a/static/mailServer/mailServer.js b/static/mailServer/mailServer.js index 6904888eb..eabb4acf5 100644 --- a/static/mailServer/mailServer.js +++ b/static/mailServer/mailServer.js @@ -1011,7 +1011,7 @@ app.controller('emailForwarding', function($scope,$http) { }; - $scope.deleteForwarding = function(destination){ + $scope.deleteForwarding = function(source, destination){ $scope.creationBox = true; $scope.emailDetails = true; @@ -1025,7 +1025,8 @@ app.controller('emailForwarding', function($scope,$http) { var data = { - destination:destination + destination:destination, + source: source }; var config = { diff --git a/websiteFunctions/views.py b/websiteFunctions/views.py index b0e71156c..f15598c12 100644 --- a/websiteFunctions/views.py +++ b/websiteFunctions/views.py @@ -48,7 +48,7 @@ def siteState(request): try: userID = request.session['userID'] wm = WebsiteManager() - return wm.suspendWebsite(request, userID) + return wm.siteState(request, userID) except KeyError: return redirect(loadLoginPage)