From d5b5d5b4504674310581b86a6383fa69fda0f9fd Mon Sep 17 00:00:00 2001 From: usmannasir <01-134132-158@student.bahria.edu.pk> Date: Wed, 14 Feb 2018 10:39:05 +0500 Subject: [PATCH] Bug fix to user permissions! --- .../baseTemplate/custom-js/system-status.js | 2 ++ .../templates/baseTemplate/index.html | 6 ++--- plogical/virtualHostUtilities.py | 3 ++- .../baseTemplate/custom-js/system-status.js | 2 ++ .../templates/websiteFunctions/index.html | 24 ------------------- websiteFunctions/views.py | 10 ++++++++ 6 files changed, 19 insertions(+), 28 deletions(-) diff --git a/baseTemplate/static/baseTemplate/custom-js/system-status.js b/baseTemplate/static/baseTemplate/custom-js/system-status.js index 656bc8003..bb03a3148 100644 --- a/baseTemplate/static/baseTemplate/custom-js/system-status.js +++ b/baseTemplate/static/baseTemplate/custom-js/system-status.js @@ -138,6 +138,8 @@ app.controller('adminController', function($scope,$http,$timeout) { $("#packageHome").hide(); $("#packageSub").hide(); $("#createWebsite").hide(); + $("#modifyWebSite").hide(); + $("#deleteWebsite").hide(); } } diff --git a/baseTemplate/templates/baseTemplate/index.html b/baseTemplate/templates/baseTemplate/index.html index 146fe4b84..720e6d67b 100755 --- a/baseTemplate/templates/baseTemplate/index.html +++ b/baseTemplate/templates/baseTemplate/index.html @@ -333,10 +333,10 @@ diff --git a/plogical/virtualHostUtilities.py b/plogical/virtualHostUtilities.py index 845a1ed44..51d314715 100644 --- a/plogical/virtualHostUtilities.py +++ b/plogical/virtualHostUtilities.py @@ -1315,7 +1315,6 @@ def installJoomla(domainName,finalPath,virtualHostUser,dbName,dbUser,dbPassword, FNULL = open(os.devnull, 'w') - if not os.path.exists(finalPath): os.makedirs(finalPath) @@ -1338,6 +1337,8 @@ def installJoomla(domainName,finalPath,virtualHostUser,dbName,dbUser,dbPassword, ## Get Joomla os.chdir(finalPath) + + if not os.path.exists("staging.zip"): command = 'wget --no-check-certificate https://github.com/joomla/joomla-cms/archive/staging.zip -P ' + finalPath cmd = shlex.split(command) diff --git a/static/baseTemplate/custom-js/system-status.js b/static/baseTemplate/custom-js/system-status.js index 656bc8003..bb03a3148 100644 --- a/static/baseTemplate/custom-js/system-status.js +++ b/static/baseTemplate/custom-js/system-status.js @@ -138,6 +138,8 @@ app.controller('adminController', function($scope,$http,$timeout) { $("#packageHome").hide(); $("#packageSub").hide(); $("#createWebsite").hide(); + $("#modifyWebSite").hide(); + $("#deleteWebsite").hide(); } } diff --git a/websiteFunctions/templates/websiteFunctions/index.html b/websiteFunctions/templates/websiteFunctions/index.html index 148169af7..b28ae845e 100644 --- a/websiteFunctions/templates/websiteFunctions/index.html +++ b/websiteFunctions/templates/websiteFunctions/index.html @@ -41,30 +41,6 @@ - -
- -
- {% trans "Modify Website" %} -
-
- -
-
-
- -
- -
- {% trans "Delete Website" %} -
-
- -
-
-
- - {% else %} diff --git a/websiteFunctions/views.py b/websiteFunctions/views.py index dfd6f2210..8c51c8dde 100644 --- a/websiteFunctions/views.py +++ b/websiteFunctions/views.py @@ -85,6 +85,11 @@ def modifyWebsite(request): try: admin = Administrator.objects.get(pk=request.session['userID']) + if admin.type == 3: + final = {'error': 1, "error_message": "Not enough privilege"} + final_json = json.dumps(final) + return HttpResponse(final_json) + if admin.type == 1: websites = Websites.objects.all() websitesName = [] @@ -126,6 +131,11 @@ def deleteWebsite(request): try: admin = Administrator.objects.get(pk=request.session['userID']) + if admin.type == 3: + final = {'error': 1, "error_message": "Not enough privilege"} + final_json = json.dumps(final) + return HttpResponse(final_json) + if admin.type == 1: websites = Websites.objects.all() websitesName = []