Skip to content
Permalink
Browse files
feature: #328
  • Loading branch information
usmannasir committed May 7, 2020
1 parent 9cc29b4 commit 5f589d0569116f8937c88f047b3cc2c27f1cacad
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
@@ -126,7 +126,7 @@ def sslForHostName(request):
else:
return ACLManager.loadError()

websitesName = ACLManager.findAllSites(currentACL, userID)
websitesName = ACLManager.findAllSites(currentACL, userID, 1)

return render(request, 'manageSSL/sslForHostName.html', {'websiteList': websitesName})
except KeyError:
@@ -151,11 +151,15 @@ def obtainHostNameSSL(request):
data = json.loads(request.body)
virtualHost = data['virtualHost']

path = "/home/" + virtualHost + "/public_html"
try:
website = Websites.objects.get(domain=virtualHost)
path = "/home/" + virtualHost + "/public_html"
except:
website = ChildDomains.objects.get(domain=virtualHost)
path = website.path

data = json.loads(request.body)
virtualHost = data['virtualHost']
admin = Administrator.objects.get(pk=userID)

if ACLManager.checkOwnership(virtualHost, admin, currentACL) == 1:
pass
else:
@@ -405,13 +405,19 @@ def loadPackageObjects(userID, finalResponse):
return admin.package_set.all()

@staticmethod
def findAllSites(currentACL, userID):
def findAllSites(currentACL, userID, fetchChilds = 0):
websiteNames = []

if currentACL['admin'] == 1:
allWebsites = Websites.objects.all()

for items in allWebsites:
websiteNames.append(items.domain)

if fetchChilds:
for child in items.childdomains_set.all():
websiteNames.append(child.domain)

else:
admin = Administrator.objects.get(pk=userID)

@@ -421,11 +427,19 @@ def findAllSites(currentACL, userID):
for items in websites:
websiteNames.append(items.domain)

if fetchChilds:
for child in items.childdomains_set.all():
websiteNames.append(child.domain)

for items in admins:
webs = items.websites_set.all()
for web in webs:
websiteNames.append(web.domain)

if fetchChilds:
for child in web.childdomains_set.all():
websiteNames.append(child.domain)


return websiteNames

0 comments on commit 5f589d0

Please sign in to comment.