diff --git a/loginSystem/views.py b/loginSystem/views.py
index 6b660cfc8..dca4a21bf 100644
--- a/loginSystem/views.py
+++ b/loginSystem/views.py
@@ -116,7 +116,7 @@ def loadLoginPage(request):
firstName="Cyber",lastName="Panel")
admin.save()
- vers = version(currentVersion="1.0",build=4)
+ vers = version(currentVersion="1.0",build=5)
vers.save()
package = Package(admin=admin, packageName="Default", diskSpace=1000,
diff --git a/packages/views.py b/packages/views.py
index fa26f1017..ebf038c13 100644
--- a/packages/views.py
+++ b/packages/views.py
@@ -26,8 +26,12 @@ def createPacakge(request):
try:
val = request.session['userID']
+
admin = Administrator.objects.get(pk=val)
+ if admin.type == 3:
+ return HttpResponse("You don't have enough privileges to access this page.")
+
except KeyError:
return redirect(loadLoginPage)
@@ -42,6 +46,9 @@ def deletePacakge(request):
admin = Administrator.objects.get(pk=val)
+ if admin.type == 3:
+ return HttpResponse("You don't have enough privileges to access this page.")
+
if admin.type == 1:
packages = Package.objects.all()
else:
@@ -130,6 +137,9 @@ def modifyPackage(request):
try:
admin = Administrator.objects.get(pk=val)
+ if admin.type == 3:
+ return HttpResponse("You don't have enough privileges to access this page.")
+
if admin.type == 1:
packages = Package.objects.all()
else:
diff --git a/plogical/upgrade.py b/plogical/upgrade.py
index 1d7601333..8eafb2519 100644
--- a/plogical/upgrade.py
+++ b/plogical/upgrade.py
@@ -100,6 +100,8 @@ class Upgrade:
upgradeLog.close()
+
+
print("Upgrade Completed.")
@staticmethod
diff --git a/static/baseTemplate/custom-js/system-status.js b/static/baseTemplate/custom-js/system-status.js
index 899b204ed..b68fdf590 100644
--- a/static/baseTemplate/custom-js/system-status.js
+++ b/static/baseTemplate/custom-js/system-status.js
@@ -127,7 +127,6 @@ app.controller('adminController', function($scope,$http,$timeout) {
$("#remoteBackups").hide();
$("#packageHome").hide();
$("#packageSub").hide();
- $("#createWebsite").hide();
}
}
diff --git a/static/userManagment/userManagment.js b/static/userManagment/userManagment.js
index 515dee333..41b45d219 100644
--- a/static/userManagment/userManagment.js
+++ b/static/userManagment/userManagment.js
@@ -22,10 +22,14 @@ app.controller('createUserCtr', function($scope,$http) {
$scope.webLimits = false;
$scope.acctsLimit = true;
}
- else{
+ else if($scope.accountType == "Reseller"){
$scope.webLimits = false;
$scope.acctsLimit = false;
}
+ else{
+ $scope.webLimits = true;
+ $scope.acctsLimit = true;
+ }
}
diff --git a/userManagment/static/userManagment/userManagment.js b/userManagment/static/userManagment/userManagment.js
index 515dee333..41b45d219 100644
--- a/userManagment/static/userManagment/userManagment.js
+++ b/userManagment/static/userManagment/userManagment.js
@@ -22,10 +22,14 @@ app.controller('createUserCtr', function($scope,$http) {
$scope.webLimits = false;
$scope.acctsLimit = true;
}
- else{
+ else if($scope.accountType == "Reseller"){
$scope.webLimits = false;
$scope.acctsLimit = false;
}
+ else{
+ $scope.webLimits = true;
+ $scope.acctsLimit = true;
+ }
}
diff --git a/userManagment/templates/userManagment/createUser.html b/userManagment/templates/userManagment/createUser.html
index d3e723e29..e49e5e675 100644
--- a/userManagment/templates/userManagment/createUser.html
+++ b/userManagment/templates/userManagment/createUser.html
@@ -64,7 +64,7 @@
diff --git a/userManagment/templates/userManagment/modifyUser.html b/userManagment/templates/userManagment/modifyUser.html
index a22bef09e..2dfeb62e6 100644
--- a/userManagment/templates/userManagment/modifyUser.html
+++ b/userManagment/templates/userManagment/modifyUser.html
@@ -70,7 +70,6 @@
diff --git a/userManagment/views.py b/userManagment/views.py
index 5dc67461c..9fbcd59ae 100644
--- a/userManagment/views.py
+++ b/userManagment/views.py
@@ -88,21 +88,24 @@ def submitUserCreation(request):
currentAdmin = Administrator.objects.get(pk=val)
+ childUsers = Administrator.objects.filter(owner=currentAdmin.pk).count()
+
if currentAdmin.type == 1:
pass
else:
if currentAdmin.initWebsitesLimit == 0:
- currentAdmin.userAccountsLimit = currentAdmin.userAccountsLimit + 1
+ pass
- elif currentAdmin.userAccountsLimit != currentAdmin.initUserAccountsLimit:
- currentAdmin.userAccountsLimit = currentAdmin.userAccountsLimit + 1
- else:
+ elif currentAdmin.initUserAccountsLimit == childUsers:
data_ret = {'createStatus': 0,
'error_message': "Reached Maximum User Creation Limit"}
final_json = json.dumps(data_ret)
return HttpResponse(final_json)
+ else:
+ pass
+
if request.method == 'POST':
data = json.loads(request.body)
@@ -116,7 +119,27 @@ def submitUserCreation(request):
accountType = data['accountType']
- if accountType == "Normal User":
+ if accountType == "Admin":
+
+ newAdmin = Administrator(firstName=firstName,
+ lastName=lastName,
+ email=email,
+ type=1,
+ userName=userName,
+ password=password,
+ initWebsitesLimit=0,
+ owner=currentAdmin.pk
+ )
+ newAdmin.save()
+ currentAdmin.save()
+
+ data_ret = {'createStatus': 1,
+ 'error_message': "None"}
+
+ final_json = json.dumps(data_ret)
+ return HttpResponse(final_json)
+
+ elif accountType == "Normal User":
websitesLimit = data['websitesLimit']
newAdmin = Administrator(firstName=firstName,
@@ -136,7 +159,6 @@ def submitUserCreation(request):
final_json = json.dumps(data_ret)
return HttpResponse(final_json)
-
else:
websitesLimit = data['websitesLimit']
userAccountsLimit = data['userAccountsLimit']
@@ -357,7 +379,7 @@ def deleteUser(request):
admins = Administrator.objects.all()
adminNames = []
for items in admins:
- if not items.type == 1:
+ if not items.userName == "admin":
adminNames.append(items.userName)
else:
admins = Administrator.objects.filter(owner=admin.pk)
diff --git a/websiteFunctions/views.py b/websiteFunctions/views.py
index 78983a12c..4b594c9fd 100644
--- a/websiteFunctions/views.py
+++ b/websiteFunctions/views.py
@@ -25,6 +25,8 @@ from os import listdir, rmdir
from shutil import move
from filemanager_app import views as fileManage
from plogical.findBWUsage import findBWUsage
+from dns.models import Domains,Records
+import requests
# Create your views here.
@@ -226,6 +228,15 @@ def submitWebsiteCreation(request):
except:
pass
+ try:
+ website = ChildDomains.objects.get(domain=domain)
+ data_ret = {"existsStatus": 0, 'createWebSiteStatus': 0,
+ 'error_message': "Website Already Exists"}
+ json_data = json.dumps(data_ret)
+ return HttpResponse(json_data)
+ except:
+ pass
+
####### Limitations check
@@ -312,6 +323,63 @@ def submitWebsiteCreation(request):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
+
+ ## zone creation and
+ try:
+
+ newZone = Domains(admin=admin, name=domain, type="NATIVE")
+ newZone.save()
+
+ content = "ns1." + domain + " hostmaster." + domain + " 1 10800 3600 604800 3600"
+
+ soaRecord = Records(domainOwner=newZone,
+ domain_id=newZone.id,
+ name=domain,
+ type="SOA",
+ content=content,
+ ttl=3600,
+ prio=0,
+ disabled=0,
+ auth=1)
+ soaRecord.save()
+
+ try:
+ recordContentA = requests.get('https://api.ipify.org').text
+ zone = Domains.objects.get(name=domain)
+ record = Records(domainOwner=zone,
+ domain_id=zone.id,
+ name=domain,
+ type="A",
+ content=recordContentA,
+ ttl=3600,
+ prio=0,
+ disabled=0,
+ auth=1)
+ record.save()
+ except:
+ pass
+
+ except:
+ try:
+ recordContentA = requests.get('https://api.ipify.org').text
+ zone = Domains.objects.get(name=domain)
+ record = Records(domainOwner=zone,
+ domain_id=zone.id,
+ name=domain,
+ type="A",
+ content=recordContentA,
+ ttl=3600,
+ prio=0,
+ disabled=0,
+ auth=1)
+ record.save()
+ except:
+ pass
+
+ ## zone creation
+
+
+
selectedPackage = Package.objects.get(packageName=packageName)
website = Websites(admin=admin, package=selectedPackage, domain=domain, adminEmail=adminEmail,