Skip to content

Commit 5f589d0

Browse files
committed
feature: #328
1 parent 9cc29b4 commit 5f589d0

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

Diff for: manageSSL/views.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def sslForHostName(request):
126126
else:
127127
return ACLManager.loadError()
128128

129-
websitesName = ACLManager.findAllSites(currentACL, userID)
129+
websitesName = ACLManager.findAllSites(currentACL, userID, 1)
130130

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

154-
path = "/home/" + virtualHost + "/public_html"
154+
try:
155+
website = Websites.objects.get(domain=virtualHost)
156+
path = "/home/" + virtualHost + "/public_html"
157+
except:
158+
website = ChildDomains.objects.get(domain=virtualHost)
159+
path = website.path
155160

156-
data = json.loads(request.body)
157-
virtualHost = data['virtualHost']
158161
admin = Administrator.objects.get(pk=userID)
162+
159163
if ACLManager.checkOwnership(virtualHost, admin, currentACL) == 1:
160164
pass
161165
else:

Diff for: plogical/acl.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -405,13 +405,19 @@ def loadPackageObjects(userID, finalResponse):
405405
return admin.package_set.all()
406406

407407
@staticmethod
408-
def findAllSites(currentACL, userID):
408+
def findAllSites(currentACL, userID, fetchChilds = 0):
409409
websiteNames = []
410410

411411
if currentACL['admin'] == 1:
412412
allWebsites = Websites.objects.all()
413+
413414
for items in allWebsites:
414415
websiteNames.append(items.domain)
416+
417+
if fetchChilds:
418+
for child in items.childdomains_set.all():
419+
websiteNames.append(child.domain)
420+
415421
else:
416422
admin = Administrator.objects.get(pk=userID)
417423

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

430+
if fetchChilds:
431+
for child in items.childdomains_set.all():
432+
websiteNames.append(child.domain)
433+
424434
for items in admins:
425435
webs = items.websites_set.all()
426436
for web in webs:
427437
websiteNames.append(web.domain)
428438

439+
if fetchChilds:
440+
for child in web.childdomains_set.all():
441+
websiteNames.append(child.domain)
442+
429443

430444
return websiteNames
431445

0 commit comments

Comments
 (0)