mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-13 16:56:09 +01:00
This commit is contained in:
@@ -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 @@ class ACLManager:
|
||||
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 @@ class ACLManager:
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user