Bug fix to user permissions!

This commit is contained in:
usmannasir 2018-02-14 10:39:05 +05:00
parent dbeb17ded0
commit d5b5d5b450
6 changed files with 19 additions and 28 deletions

View File

@ -138,6 +138,8 @@ app.controller('adminController', function($scope,$http,$timeout) {
$("#packageHome").hide();
$("#packageSub").hide();
$("#createWebsite").hide();
$("#modifyWebSite").hide();
$("#deleteWebsite").hide();
}
}

View File

@ -333,10 +333,10 @@
<ul>
<li id="createWebsite"><a href="{% url 'createWebsite' %}" title="{% trans 'Create Website' %}"><span>{% trans "Create Website" %}</span></a></li>
<li><a href="{% url 'listWebsites' %}" title="{% trans 'List Websites' %}"><span>{% trans "List Websites" %}</span></a></li>
<li><a href="{% url 'modifyWebsite' %}" title="{% trans 'Modify Website' %}"><span>{% trans "Modify Website" %}</span></a></li>
<li ><a href="{% url 'listWebsites' %}" title="{% trans 'List Websites' %}"><span>{% trans "List Websites" %}</span></a></li>
<li id="modifyWebSite"><a href="{% url 'modifyWebsite' %}" title="{% trans 'Modify Website' %}"><span>{% trans "Modify Website" %}</span></a></li>
<li id="siteState"><a href="{% url 'siteState' %}" title="{% trans 'Suspend/Unsuspend' %}"><span>{% trans "Suspend/Unsuspend" %}</span></a></li>
<li><a href="{% url 'deleteWebsite' %}" title="{% trans 'Delete Website' %}"><span>{% trans "Delete Website" %}</span></a></li>
<li id="deleteWebsite"><a href="{% url 'deleteWebsite' %}" title="{% trans 'Delete Website' %}"><span>{% trans "Delete Website" %}</span></a></li>
</ul>
</div><!-- .sidebar-submenu -->

View File

@ -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)

View File

@ -138,6 +138,8 @@ app.controller('adminController', function($scope,$http,$timeout) {
$("#packageHome").hide();
$("#packageSub").hide();
$("#createWebsite").hide();
$("#modifyWebSite").hide();
$("#deleteWebsite").hide();
}
}

View File

@ -41,30 +41,6 @@
</a>
</div>
<div class="col-md-4">
<a href="{% url 'modifyWebsite' %}" title="{% trans 'Modify Website' %}" class="tile-box tile-box-shortcut btn-primary">
<div class="tile-header">
{% trans "Modify Website" %}
</div>
<div class="tile-content-wrapper">
<i class="glyph-icon icon-dashboard"></i>
</div>
</a>
</div>
<div class="col-md-4">
<a href="{% url 'deleteWebsite' %}" title="{% trans 'Delete Website' %}" class="tile-box tile-box-shortcut btn-primary">
<div class="tile-header">
{% trans "Delete Website" %}
</div>
<div class="tile-content-wrapper">
<i class="glyph-icon icon-dashboard"></i>
</div>
</a>
</div>
</div>
{% else %}

View File

@ -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 = []