mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-06 21:35:55 +01:00
Bug fix to permissions and DNS creation!
This commit is contained in:
@@ -137,6 +137,7 @@ app.controller('adminController', function($scope,$http,$timeout) {
|
|||||||
$("#remoteBackups").hide();
|
$("#remoteBackups").hide();
|
||||||
$("#packageHome").hide();
|
$("#packageHome").hide();
|
||||||
$("#packageSub").hide();
|
$("#packageSub").hide();
|
||||||
|
$("#createWebsite").hide();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,12 +46,16 @@ def getAdminStatus(request):
|
|||||||
else:
|
else:
|
||||||
admin_type = "Normal User"
|
admin_type = "Normal User"
|
||||||
|
|
||||||
serverIPAddress = "192.168.100.1"
|
# read server IP
|
||||||
|
|
||||||
try:
|
try:
|
||||||
serverIPAddress = requests.get('https://api.ipify.org').text
|
ipFile = "/etc/cyberpanel/machineIP"
|
||||||
except:
|
f = open(ipFile)
|
||||||
pass
|
ipData = f.read()
|
||||||
|
serverIPAddress = ipData.split('\n', 1)[0]
|
||||||
|
except BaseException,msg:
|
||||||
|
logging.CyberCPLogFileWriter.writeToFile("Failed to read machine IP, error:" +str(msg))
|
||||||
|
serverIPAddress = "192.168.100.1"
|
||||||
|
|
||||||
adminName = administrator.firstName + " " + administrator.lastName
|
adminName = administrator.firstName + " " + administrator.lastName
|
||||||
|
|
||||||
|
|||||||
@@ -259,8 +259,12 @@ def addDeleteDNSRecords(request):
|
|||||||
admin = Administrator.objects.get(pk=val)
|
admin = Administrator.objects.get(pk=val)
|
||||||
domainsList = []
|
domainsList = []
|
||||||
|
|
||||||
|
if admin.type == 1:
|
||||||
domains = Domains.objects.all()
|
domains = Domains.objects.all()
|
||||||
|
for items in domains:
|
||||||
|
domainsList.append(items.name)
|
||||||
|
else:
|
||||||
|
domains = admin.domains_set.all()
|
||||||
for items in domains:
|
for items in domains:
|
||||||
domainsList.append(items.name)
|
domainsList.append(items.name)
|
||||||
|
|
||||||
|
|||||||
@@ -2381,6 +2381,14 @@ def main():
|
|||||||
logging.InstallLog.writeToFile("Starting CyberPanel installation..")
|
logging.InstallLog.writeToFile("Starting CyberPanel installation..")
|
||||||
preFlightsChecks.stdOut("Starting CyberPanel installation..")
|
preFlightsChecks.stdOut("Starting CyberPanel installation..")
|
||||||
|
|
||||||
|
## Writing public IP
|
||||||
|
|
||||||
|
os.mkdir("/etc/cyberpanel")
|
||||||
|
|
||||||
|
machineIP = open("/etc/cyberpanel/machineIP", "w")
|
||||||
|
machineIP.writelines(args.publicip)
|
||||||
|
machineIP.close()
|
||||||
|
|
||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
|
|
||||||
checks = preFlightsChecks("/usr/local/lsws/",args.publicip,"/usr/local",cwd,"/usr/local/CyberCP")
|
checks = preFlightsChecks("/usr/local/lsws/",args.publicip,"/usr/local",cwd,"/usr/local/CyberCP")
|
||||||
|
|||||||
@@ -1128,8 +1128,6 @@ def Main(cwd):
|
|||||||
|
|
||||||
InstallCyberPanel.mysql_Root_password = randomPassword.generate_pass()
|
InstallCyberPanel.mysql_Root_password = randomPassword.generate_pass()
|
||||||
|
|
||||||
os.mkdir("/etc/cyberpanel")
|
|
||||||
|
|
||||||
|
|
||||||
password = open("/etc/cyberpanel/mysqlPassword","w")
|
password = open("/etc/cyberpanel/mysqlPassword","w")
|
||||||
password.writelines(InstallCyberPanel.mysql_Root_password)
|
password.writelines(InstallCyberPanel.mysql_Root_password)
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ app.controller('adminController', function($scope,$http,$timeout) {
|
|||||||
$("#remoteBackups").hide();
|
$("#remoteBackups").hide();
|
||||||
$("#packageHome").hide();
|
$("#packageHome").hide();
|
||||||
$("#packageSub").hide();
|
$("#packageSub").hide();
|
||||||
|
$("#createWebsite").hide();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Domain</th>
|
<th>Domain</th>
|
||||||
<th>Launch</th>
|
<th>Launch</th>
|
||||||
|
<th>IP Address</th>
|
||||||
<th>Package</th>
|
<th>Package</th>
|
||||||
<th>Owner</th>
|
<th>Owner</th>
|
||||||
<th>State</th>
|
<th>State</th>
|
||||||
@@ -38,6 +39,7 @@
|
|||||||
<tr ng-repeat="web in WebSitesList track by $index">
|
<tr ng-repeat="web in WebSitesList track by $index">
|
||||||
<td ng-bind="web.domain"></td>
|
<td ng-bind="web.domain"></td>
|
||||||
<td><a href="{$ web.domain $}"><img width="30px" height="30" class="center-block" src="{% static 'baseTemplate/assets/image-resources/webPanel.png' %}"></a></td>
|
<td><a href="{$ web.domain $}"><img width="30px" height="30" class="center-block" src="{% static 'baseTemplate/assets/image-resources/webPanel.png' %}"></a></td>
|
||||||
|
<td ng-bind="web.ipAddress"></td>
|
||||||
<td ng-bind="web.package"></td>
|
<td ng-bind="web.package"></td>
|
||||||
<td ng-bind="web.admin"></td>
|
<td ng-bind="web.admin"></td>
|
||||||
<td ng-bind="web.state"></td>
|
<td ng-bind="web.state"></td>
|
||||||
|
|||||||
@@ -312,7 +312,12 @@ def submitWebsiteCreation(request):
|
|||||||
soaRecord.save()
|
soaRecord.save()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
recordContentA = requests.get('https://api.ipify.org').text
|
|
||||||
|
ipFile = "/etc/cyberpanel/machineIP"
|
||||||
|
f = open(ipFile)
|
||||||
|
ipData = f.read()
|
||||||
|
recordContentA = ipData.split('\n', 1)[0]
|
||||||
|
|
||||||
zone = Domains.objects.get(name=domain)
|
zone = Domains.objects.get(name=domain)
|
||||||
record = Records(domainOwner=zone,
|
record = Records(domainOwner=zone,
|
||||||
domain_id=zone.id,
|
domain_id=zone.id,
|
||||||
@@ -324,12 +329,16 @@ def submitWebsiteCreation(request):
|
|||||||
disabled=0,
|
disabled=0,
|
||||||
auth=1)
|
auth=1)
|
||||||
record.save()
|
record.save()
|
||||||
except:
|
except BaseException,msg:
|
||||||
pass
|
logging.CyberCPLogFileWriter.writeToFile("Unable to add A record while creating website, error: " + str(msg))
|
||||||
|
|
||||||
except:
|
except:
|
||||||
try:
|
try:
|
||||||
recordContentA = requests.get('https://api.ipify.org').text
|
ipFile = "/etc/cyberpanel/machineIP"
|
||||||
|
f = open(ipFile)
|
||||||
|
ipData = f.read()
|
||||||
|
recordContentA = ipData.split('\n', 1)[0]
|
||||||
|
|
||||||
zone = Domains.objects.get(name=domain)
|
zone = Domains.objects.get(name=domain)
|
||||||
record = Records(domainOwner=zone,
|
record = Records(domainOwner=zone,
|
||||||
domain_id=zone.id,
|
domain_id=zone.id,
|
||||||
@@ -341,15 +350,14 @@ def submitWebsiteCreation(request):
|
|||||||
disabled=0,
|
disabled=0,
|
||||||
auth=1)
|
auth=1)
|
||||||
record.save()
|
record.save()
|
||||||
except:
|
except BaseException,msg:
|
||||||
pass
|
logging.CyberCPLogFileWriter.writeToFile("Unable to add A record while creating website, error: " + str(msg))
|
||||||
|
|
||||||
## zone creation
|
## zone creation
|
||||||
|
|
||||||
selectedPackage = Package.objects.get(packageName=packageName)
|
selectedPackage = Package.objects.get(packageName=packageName)
|
||||||
|
|
||||||
website = Websites(admin=admin, package=selectedPackage, domain=domain, adminEmail=adminEmail,
|
website = Websites(admin=admin, package=selectedPackage, domain=domain, adminEmail=adminEmail,phpSelection=phpSelection, ssl=data['ssl'], externalApp=externalApp)
|
||||||
phpSelection=phpSelection, ssl=data['ssl'], externalApp=externalApp)
|
|
||||||
|
|
||||||
website.save()
|
website.save()
|
||||||
|
|
||||||
@@ -567,12 +575,21 @@ def getFurtherAccounts(request):
|
|||||||
json_data = "["
|
json_data = "["
|
||||||
checker = 0
|
checker = 0
|
||||||
|
|
||||||
|
try:
|
||||||
|
ipFile = "/etc/cyberpanel/machineIP"
|
||||||
|
f = open(ipFile)
|
||||||
|
ipData = f.read()
|
||||||
|
ipAddress = ipData.split('\n', 1)[0]
|
||||||
|
except BaseException, msg:
|
||||||
|
logging.CyberCPLogFileWriter.writeToFile("Failed to read machine IP, error:" + str(msg))
|
||||||
|
ipAddress = "192.168.100.1"
|
||||||
|
|
||||||
for items in websites:
|
for items in websites:
|
||||||
if items.state == 0:
|
if items.state == 0:
|
||||||
state = "Suspended"
|
state = "Suspended"
|
||||||
else:
|
else:
|
||||||
state = "Active"
|
state = "Active"
|
||||||
dic = {'domain': items.domain, 'adminEmail': items.adminEmail,'admin': items.admin.userName,'package': items.package.packageName,'state':state}
|
dic = {'domain': items.domain, 'adminEmail': items.adminEmail,'ipAddress':ipAddress,'admin': items.admin.userName,'package': items.package.packageName,'state':state}
|
||||||
|
|
||||||
if checker == 0:
|
if checker == 0:
|
||||||
json_data = json_data + json.dumps(dic)
|
json_data = json_data + json.dumps(dic)
|
||||||
|
|||||||
Reference in New Issue
Block a user