ACL Manager
This commit is contained in:
parent
5daf2513d9
commit
930e1a2f8e
400
backup/views.py
400
backup/views.py
|
|
@ -16,10 +16,10 @@ import plogical.backupUtilities as backupUtil
|
|||
import shlex
|
||||
import subprocess
|
||||
import requests
|
||||
from baseTemplate.models import version
|
||||
from plogical.virtualHostUtilities import virtualHostUtilities
|
||||
from random import randint
|
||||
from plogical.mailUtilities import mailUtilities
|
||||
from plogical.acl import ACLManager
|
||||
|
||||
|
||||
|
||||
|
|
@ -30,80 +30,24 @@ def loadBackupHome(request):
|
|||
viewStatus = 1
|
||||
if admin.type == 3:
|
||||
viewStatus = 0
|
||||
|
||||
return render(request,'backup/index.html',{"viewStatus":viewStatus})
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def restoreSite(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
try:
|
||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||
|
||||
if admin.type == 1:
|
||||
|
||||
path = os.path.join("/home","backup")
|
||||
|
||||
if not os.path.exists(path):
|
||||
return render(request, 'backup/restore.html')
|
||||
else:
|
||||
all_files = []
|
||||
ext = ".tar.gz"
|
||||
|
||||
command = 'sudo chown -R cyberpanel:cyberpanel '+ path
|
||||
|
||||
cmd = shlex.split(command)
|
||||
|
||||
res = subprocess.call(cmd)
|
||||
|
||||
files = os.listdir(path)
|
||||
for filename in files:
|
||||
if filename.endswith(ext):
|
||||
all_files.append(filename)
|
||||
|
||||
return render(request, 'backup/restore.html',{'backups':all_files})
|
||||
|
||||
else:
|
||||
return HttpResponse("You should be admin to perform restores.")
|
||||
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return HttpResponse(str(msg))
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def backupSite(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if admin.type == 1:
|
||||
websites = Websites.objects.all()
|
||||
websitesName = []
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['createBackup'] == 1:
|
||||
pass
|
||||
else:
|
||||
if admin.type == 2:
|
||||
websites = admin.websites_set.all()
|
||||
admins = Administrator.objects.filter(owner=admin.pk)
|
||||
websitesName = []
|
||||
return ACLManager.loadError()
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
|
||||
for items in admins:
|
||||
webs = items.websites_set.all()
|
||||
|
||||
for web in webs:
|
||||
websitesName.append(web.domain)
|
||||
else:
|
||||
websitesName = []
|
||||
websites = Websites.objects.filter(admin=admin)
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||
|
||||
return render(request, 'backup/backup.html', {'websiteList':websitesName})
|
||||
except BaseException, msg:
|
||||
|
|
@ -112,27 +56,63 @@ def backupSite(request):
|
|||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def restoreSite(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['restoreBackup'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
path = os.path.join("/home", "backup")
|
||||
|
||||
if not os.path.exists(path):
|
||||
return render(request, 'backup/restore.html')
|
||||
else:
|
||||
all_files = []
|
||||
ext = ".tar.gz"
|
||||
|
||||
command = 'sudo chown -R cyberpanel:cyberpanel ' + path
|
||||
cmd = shlex.split(command)
|
||||
subprocess.call(cmd)
|
||||
|
||||
files = os.listdir(path)
|
||||
for filename in files:
|
||||
if filename.endswith(ext):
|
||||
all_files.append(filename)
|
||||
|
||||
return render(request, 'backup/restore.html', {'backups': all_files})
|
||||
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return HttpResponse(str(msg))
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def getCurrentBackups(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
|
||||
data = json.loads(request.body)
|
||||
backupDomain = data['websiteToBeBacked']
|
||||
website = Websites.objects.get(domain=backupDomain)
|
||||
|
||||
if admin.type != 1:
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] != 1:
|
||||
if website.admin != admin:
|
||||
dic = {'fetchStatus': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
return ACLManager.loadErrorJson('fetchStatus', 0)
|
||||
|
||||
backups = website.backups_set.all()
|
||||
|
||||
|
||||
json_data = "["
|
||||
checker = 0
|
||||
|
||||
|
|
@ -320,11 +300,10 @@ def cancelBackupCreation(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def deleteBackup(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
|
|
@ -332,11 +311,11 @@ def deleteBackup(request):
|
|||
backupID = data['backupID']
|
||||
backup = Backups.objects.get(id=backupID)
|
||||
|
||||
if admin.type != 1:
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] != 1:
|
||||
if backup.website.admin != admin:
|
||||
dic = {'deleteStatus': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
return ACLManager.loadErrorJson('deleteStatus', 0)
|
||||
|
||||
domainName = backup.website.domain
|
||||
|
||||
|
|
@ -344,7 +323,7 @@ def deleteBackup(request):
|
|||
|
||||
command = 'sudo rm -f ' + path
|
||||
cmd = shlex.split(command)
|
||||
res = subprocess.call(cmd)
|
||||
subprocess.call(cmd)
|
||||
|
||||
backup.delete()
|
||||
|
||||
|
|
@ -378,9 +357,7 @@ def submitRestore(request):
|
|||
dir = "CyberPanelRestore"
|
||||
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
||||
|
||||
execPath = execPath + " submitRestore --backupFile " + backupFile + " --dir " + dir
|
||||
|
||||
subprocess.Popen(shlex.split(execPath))
|
||||
|
||||
time.sleep(4)
|
||||
|
|
@ -394,7 +371,6 @@ def submitRestore(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def restoreStatus(request):
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
|
@ -454,28 +430,35 @@ def restoreStatus(request):
|
|||
|
||||
def backupDestinations(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if admin.type == 1:
|
||||
return render(request, 'backup/backupDestinations.html', {})
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['addDeleteDestinations'] == 1:
|
||||
pass
|
||||
else:
|
||||
return HttpResponse("You should be admin to add backup destinations.")
|
||||
return ACLManager.loadError()
|
||||
|
||||
return render(request, 'backup/backupDestinations.html', {})
|
||||
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def submitDestinationCreation(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'destStatus': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['addDeleteDestinations'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('destStatus', 0)
|
||||
|
||||
|
||||
destinations = backupUtil.backupUtilities.destinationsPath
|
||||
|
|
@ -537,15 +520,18 @@ def submitDestinationCreation(request):
|
|||
|
||||
def getCurrentBackupDestinations(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'fetchStatus': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['addDeleteDestinations'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('fetchStatus', 0)
|
||||
|
||||
records = dest.objects.all()
|
||||
|
||||
|
|
@ -580,7 +566,6 @@ def getCurrentBackupDestinations(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def getConnectionStatus(request):
|
||||
try:
|
||||
try:
|
||||
|
|
@ -612,15 +597,18 @@ def getConnectionStatus(request):
|
|||
|
||||
def deleteDestination(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'delStatus': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['addDeleteDestinations'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('delStatus',0)
|
||||
|
||||
|
||||
data = json.loads(request.body)
|
||||
|
|
@ -674,46 +662,49 @@ def deleteDestination(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def scheduleBackup(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if admin.type == 1:
|
||||
|
||||
if dest.objects.all().count() <= 1:
|
||||
try:
|
||||
homeDest = dest(destLoc="Home")
|
||||
homeDest.save()
|
||||
except:
|
||||
pass
|
||||
backups = dest.objects.all()
|
||||
|
||||
destinations = []
|
||||
|
||||
for items in backups:
|
||||
destinations.append(items.destLoc)
|
||||
|
||||
return render(request,'backup/backupSchedule.html',{'destinations':destinations})
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['scheDuleBackups'] == 1:
|
||||
pass
|
||||
else:
|
||||
return HttpResponse("You should be admin to schedule backups.")
|
||||
return ACLManager.loadError()
|
||||
|
||||
if dest.objects.all().count() <= 1:
|
||||
try:
|
||||
homeDest = dest(destLoc="Home")
|
||||
homeDest.save()
|
||||
except:
|
||||
pass
|
||||
backups = dest.objects.all()
|
||||
|
||||
destinations = []
|
||||
|
||||
for items in backups:
|
||||
destinations.append(items.destLoc)
|
||||
|
||||
return render(request, 'backup/backupSchedule.html', {'destinations': destinations})
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def getCurrentBackupSchedules(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'fetchStatus': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['scheDuleBackups'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('fetchStatus', 0)
|
||||
|
||||
records = backupSchedules.objects.all()
|
||||
|
||||
|
|
@ -749,18 +740,21 @@ def getCurrentBackupSchedules(request):
|
|||
|
||||
def submitBackupSchedule(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
data = json.loads(request.body)
|
||||
backupDest = data['backupDest']
|
||||
backupFreq = data['backupFreq']
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'scheduleStatus': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['scheDuleBackups'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('scheduleStatus', 0)
|
||||
|
||||
path = "/etc/crontab"
|
||||
|
||||
|
|
@ -956,18 +950,20 @@ def submitBackupSchedule(request):
|
|||
final_json = json.dumps({'scheduleStatus': 0, 'error_message': str(msg)})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def scheduleDelete(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'delStatus': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['scheDuleBackups'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('scheduleStatus', 0)
|
||||
|
||||
data = json.loads(request.body)
|
||||
backupDest = data['destLoc']
|
||||
|
|
@ -1101,26 +1097,33 @@ def scheduleDelete(request):
|
|||
def remoteBackups(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['remoteBackups'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough priviliges to access this page.")
|
||||
return render(request, 'backup/remoteBackups.html')
|
||||
|
||||
return render(request,'backup/remoteBackups.html')
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def submitRemoteBackups(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['remoteBackups'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
|
||||
data = json.loads(request.body)
|
||||
ipAddress = data['ipAddress']
|
||||
|
|
@ -1241,16 +1244,19 @@ def submitRemoteBackups(request):
|
|||
|
||||
def starRemoteTransfer(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
data = json.loads(request.body)
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'remoteTransferStatus': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['remoteBackups'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('remoteTransferStatus', 0)
|
||||
|
||||
ipAddress = data['ipAddress']
|
||||
password = data['password']
|
||||
|
|
@ -1313,15 +1319,17 @@ def starRemoteTransfer(request):
|
|||
|
||||
def getRemoteTransferStatus(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
userID = request.session['userID']
|
||||
if request.method == "POST":
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'remoteTransferStatus': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['remoteBackups'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('remoteTransferStatus', 0)
|
||||
|
||||
data = json.loads(request.body)
|
||||
ipAddress = data['ipAddress']
|
||||
|
|
@ -1362,18 +1370,20 @@ def getRemoteTransferStatus(request):
|
|||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def remoteBackupRestore(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if request.method == "POST":
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'remoteRestoreStatus': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['remoteBackups'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('remoteRestoreStatus', 0)
|
||||
|
||||
data = json.loads(request.body)
|
||||
backupDir = data['backupDir']
|
||||
|
|
@ -1410,15 +1420,17 @@ def remoteBackupRestore(request):
|
|||
|
||||
def localRestoreStatus(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
if request.method == "POST":
|
||||
|
||||
if admin.type != 1:
|
||||
data_ret = {'remoteTransferStatus': 0, 'error_message': "No such log found", "status": "None",
|
||||
"complete": 0}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['remoteBackups'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('remoteTransferStatus', 0)
|
||||
|
||||
data = json.loads(request.body)
|
||||
backupDir = data['backupDir']
|
||||
|
|
@ -1464,13 +1476,15 @@ def localRestoreStatus(request):
|
|||
|
||||
def cancelRemoteBackup(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'cancelStatus': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['remoteBackups'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('cancelStatus', 0)
|
||||
|
||||
if request.method == "POST":
|
||||
|
||||
|
|
@ -1506,8 +1520,6 @@ def cancelRemoteBackup(request):
|
|||
data = {'cancelStatus': 1, 'error_message': "None"}
|
||||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
data = {'cancelStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data)
|
||||
|
|
|
|||
|
|
@ -70,16 +70,13 @@ app.controller('systemStatusInfo', function($scope,$http,$timeout) {
|
|||
|
||||
function ListInitialData(response) {
|
||||
|
||||
|
||||
$scope.cpuUsage = response.data.cpuUsage;
|
||||
$scope.ramUsage = response.data.ramUsage;
|
||||
$scope.diskUsage = response.data.diskUsage;
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialData(response) {
|
||||
console.log("not good");
|
||||
}
|
||||
function cantLoadInitialData(response) {}
|
||||
|
||||
//$timeout(getStuff, 2000);
|
||||
|
||||
|
|
@ -103,52 +100,173 @@ app.controller('adminController', function($scope,$http,$timeout) {
|
|||
function ListInitialData(response) {
|
||||
|
||||
|
||||
$scope.currentAdmin = response.data.user_name;
|
||||
$scope.currentAdmin = response.data.adminName;
|
||||
$scope.admin_type = response.data.admin_type;
|
||||
|
||||
|
||||
$("#serverIPAddress").text(response.data.serverIPAddress);
|
||||
|
||||
if (response.data.admin_type !== "Administrator")
|
||||
{
|
||||
if (response.data.admin === 0) {
|
||||
$('.serverACL').hide();
|
||||
|
||||
if(response.data.admin_type !== "Reseller") {
|
||||
$("#normalUser").hide();
|
||||
$("#normalUserA").hide();
|
||||
$("#normalUserB").hide();
|
||||
|
||||
if(!Boolean(response.data.versionManagement)){
|
||||
$('.versionManagement').hide();
|
||||
}
|
||||
// User Management
|
||||
if(!Boolean(response.data.createNewUser)){
|
||||
$('.createNewUser').hide();
|
||||
}
|
||||
if(!Boolean(response.data.resellerCenter)){
|
||||
$('.resellerCenter').hide();
|
||||
}
|
||||
if(!Boolean(response.data.deleteUser)){
|
||||
$('.deleteUser').hide();
|
||||
}
|
||||
if(!Boolean(response.data.changeUserACL)){
|
||||
$('.changeUserACL').hide();
|
||||
}
|
||||
// Website Management
|
||||
if(!Boolean(response.data.createWebsite)){
|
||||
$('.createWebsite').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.modifyWebsite)){
|
||||
$('.modifyWebsite').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.suspendWebsite)){
|
||||
$('.suspendWebsite').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.deleteWebsite)){
|
||||
$('.deleteWebsite').hide();
|
||||
}
|
||||
|
||||
$("#normalUserC").hide();
|
||||
$("#normalUserD").hide();
|
||||
$("#normalUserE").hide();
|
||||
$("#normalUserF").hide();
|
||||
$("#normalUserG").hide();
|
||||
$("#normalUserH").hide();
|
||||
$("#normalUserP").hide();
|
||||
$("#normalUserI").hide();
|
||||
// Package Management
|
||||
|
||||
$("#ssl").hide();
|
||||
$("#sslA").hide();
|
||||
$("#siteState").hide();
|
||||
if(!Boolean(response.data.createPackage)){
|
||||
$('.createPackage').hide();
|
||||
}
|
||||
|
||||
$("#restoreSite").hide();
|
||||
$("#backupDestinations").hide();
|
||||
$("#scheduleBackup").hide();
|
||||
if(!Boolean(response.data.deletePackage)){
|
||||
$('.deletePackage').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.modifyPackage)){
|
||||
$('.modifyPackage').hide();
|
||||
}
|
||||
|
||||
// Database Management
|
||||
|
||||
if(!Boolean(response.data.createDatabase)){
|
||||
$('.createDatabase').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.deleteDatabase)){
|
||||
$('.deleteDatabase').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.listDatabases)){
|
||||
$('.listDatabases').hide();
|
||||
}
|
||||
|
||||
// DNS Management
|
||||
|
||||
if(!Boolean(response.data.createNameServer)){
|
||||
$('.createNameServer').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.createDNSZone)){
|
||||
$('.createDNSZone').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.deleteZone)){
|
||||
$('.addDeleteRecords').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.addDeleteRecords)){
|
||||
$('.deleteDatabase').hide();
|
||||
}
|
||||
|
||||
// Email Management
|
||||
|
||||
if(!Boolean(response.data.createEmail)){
|
||||
$('.createEmail').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.deleteEmail)){
|
||||
$('.deleteEmail').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.emailForwarding)){
|
||||
$('.emailForwarding').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.changeEmailPassword)){
|
||||
$('.changeEmailPassword').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.dkimManager)){
|
||||
$('.dkimManager').hide();
|
||||
}
|
||||
|
||||
|
||||
// FTP Management
|
||||
|
||||
if(!Boolean(response.data.createFTPAccount)){
|
||||
$('.createFTPAccount').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.deleteFTPAccount)){
|
||||
$('.deleteFTPAccount').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.listFTPAccounts)){
|
||||
$('.listFTPAccounts').hide();
|
||||
}
|
||||
|
||||
// Backup Management
|
||||
|
||||
if(!Boolean(response.data.createBackup)){
|
||||
$('.createBackup').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.restoreBackup)){
|
||||
$('.restoreBackup').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.addDeleteDestinations)){
|
||||
$('.addDeleteDestinations').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.scheDuleBackups)){
|
||||
$('.scheDuleBackups').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.remoteBackups)){
|
||||
$('.remoteBackups').hide();
|
||||
}
|
||||
|
||||
|
||||
// SSL Management
|
||||
|
||||
if(!Boolean(response.data.manageSSL)){
|
||||
$('.manageSSL').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.hostnameSSL)){
|
||||
$('.hostnameSSL').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.mailServerSSL)){
|
||||
$('.mailServerSSL').hide();
|
||||
}
|
||||
|
||||
$("#remoteBackups").hide();
|
||||
$("#packageHome").hide();
|
||||
$("#packageSub").hide();
|
||||
$("#createWebsite").hide();
|
||||
$("#modifyWebSite").hide();
|
||||
$("#deleteWebsite").hide();
|
||||
$("#versionManagement").hide();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function cantLoadInitialData(response) {
|
||||
console.log("not good");
|
||||
}
|
||||
function cantLoadInitialData(response) {}
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
|
||||
<!--- Hide statistics for non-admins--->
|
||||
{% if type < 3 %}
|
||||
{% if admin %}
|
||||
<div ng-controller="homePageStatus" class="panel">
|
||||
<div class="panel-body">
|
||||
<h3 class="title-hero">
|
||||
|
|
@ -100,16 +100,14 @@
|
|||
{% trans "Available Functions" %}
|
||||
</h3>
|
||||
|
||||
{% if type == 1 %}
|
||||
<!--- If type is admin--->
|
||||
<div class="example-box-wrapper">
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4">
|
||||
<a href="{% url 'loadUsersHome' %}" title="{% trans 'User Functions' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<span class="bs-badge badge-absolute">4</span>
|
||||
<span class="bs-badge badge-absolute">9</span>
|
||||
<div class="tile-header">
|
||||
{% trans "Users" %}
|
||||
</div>
|
||||
|
|
@ -117,10 +115,9 @@
|
|||
<i class="glyph-icon icon-dashboard"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-4">
|
||||
<a href="{% url 'loadWebsitesHome' %}" title="{% trans 'Website Functions' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<span class="bs-badge badge-absolute">5</span>
|
||||
<div class="tile-header">
|
||||
|
|
@ -132,7 +129,6 @@
|
|||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4">
|
||||
<a href="{% url 'packagesHome' %}" title="{% trans 'Add/Modify Packages' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<span class="bs-badge badge-absolute">3</span>
|
||||
|
|
@ -145,18 +141,6 @@
|
|||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
|
||||
<div class="col-md-4">
|
||||
<a href="{% url 'loadDatabaseHome' %}" title="{% trans 'Database Functions' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<span class="bs-badge badge-absolute">3</span>
|
||||
|
|
@ -167,9 +151,9 @@
|
|||
<i class="glyph-icon icon-dashboard"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-4">
|
||||
<a href="{% url 'dnsHome' %}" title="{% trans 'Control DNS' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<span class="bs-badge badge-absolute">4</span>
|
||||
<div class="tile-header">
|
||||
|
|
@ -181,10 +165,9 @@
|
|||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-4">
|
||||
<a href="{% url 'loadFTPHome' %}" title="{% trans 'FTP Functions' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<span class="bs-badge badge-absolute">2</span>
|
||||
<span class="bs-badge badge-absolute">3</span>
|
||||
<div class="tile-header">
|
||||
{% trans "FTP" %}
|
||||
</div>
|
||||
|
|
@ -194,15 +177,9 @@
|
|||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-4">
|
||||
<a href="{% url 'loadBackupHome' %}" title="{% trans 'Back up' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<span class="bs-badge badge-absolute">2</span>
|
||||
<span class="bs-badge badge-absolute">5</span>
|
||||
<div class="tile-header">
|
||||
{% trans "Back up" %}
|
||||
</div>
|
||||
|
|
@ -212,44 +189,33 @@
|
|||
</a>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<a href="{% url 'loadEmailHome' %}" title="{% trans 'Emails' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<span class="bs-badge badge-absolute">4</span>
|
||||
<div class="tile-header">
|
||||
{% trans "Emails" %}
|
||||
</div>
|
||||
<div class="tile-content-wrapper">
|
||||
<i class="glyph-icon icon-dashboard"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<a href="{% url 'loadEmailHome' %}" title="{% trans 'Emails' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<span class="bs-badge badge-absolute">6</span>
|
||||
<div class="tile-header">
|
||||
{% trans "Emails" %}
|
||||
</div>
|
||||
<div class="tile-content-wrapper">
|
||||
<i class="glyph-icon icon-dashboard"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<a href="{% url 'loadTuningHome' %}" title="{% trans 'Server Tuning' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<span class="bs-badge badge-absolute">2</span>
|
||||
<div class="tile-header">
|
||||
{% trans "Server Tuning" %}
|
||||
</div>
|
||||
<div class="tile-content-wrapper">
|
||||
<i class="glyph-icon icon-dashboard"></i>
|
||||
</div>
|
||||
</a>
|
||||
<a href="{% url 'loadSSLHome' %}" title="{% trans 'SSL' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<span class="bs-badge badge-absolute">3</span>
|
||||
<div class="tile-header">
|
||||
{% trans "SSL" %}
|
||||
</div>
|
||||
<div class="tile-content-wrapper">
|
||||
<i class="glyph-icon icon-dashboard"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{% if admin %}
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-4">
|
||||
<a href="{% url 'serverStatusHome' %}" title="{% trans 'Server Status' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<span class="bs-badge badge-absolute">2</span>
|
||||
<div class="tile-header">
|
||||
|
|
@ -261,8 +227,7 @@
|
|||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-4">
|
||||
<a href="{% url 'loadPHPHome' %}" title="{% trans 'PHP Configurations' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<span class="bs-badge badge-absolute">2</span>
|
||||
<div class="tile-header">
|
||||
|
|
@ -286,18 +251,7 @@
|
|||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-4">
|
||||
<a href="{% url 'securityHome' %}" title="{% trans 'Security' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<span class="bs-badge badge-absolute">4</span>
|
||||
<div class="tile-header">
|
||||
|
|
@ -309,135 +263,11 @@
|
|||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!--- If type is admin--->
|
||||
|
||||
{% else %}
|
||||
|
||||
<!--- If type is user--->
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4">
|
||||
<a href="{% url 'loadUsersHome' %}" title="{% trans 'User Functions' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<span class="bs-badge badge-absolute">4</span>
|
||||
<div class="tile-header">
|
||||
{% trans "Users" %}
|
||||
</div>
|
||||
<div class="tile-content-wrapper">
|
||||
<i class="glyph-icon icon-dashboard"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4">
|
||||
<a href="{% url 'loadWebsitesHome' %}" title="{% trans 'Website Functions' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<span class="bs-badge badge-absolute">5</span>
|
||||
<div class="tile-header">
|
||||
{% trans "Websites" %}
|
||||
</div>
|
||||
<div class="tile-content-wrapper">
|
||||
<i class="glyph-icon icon-dashboard"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4">
|
||||
<a href="{% url 'loadDatabaseHome' %}" title="{% trans 'Database Functions' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<span class="bs-badge badge-absolute">3</span>
|
||||
<div class="tile-header">
|
||||
{% trans "Databases" %}
|
||||
</div>
|
||||
<div class="tile-content-wrapper">
|
||||
<i class="glyph-icon icon-dashboard"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
|
||||
<div class="col-md-4">
|
||||
<a href="{% url 'dnsHome' %}" title="{% trans 'Control DNS' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<span class="bs-badge badge-absolute">4</span>
|
||||
<div class="tile-header">
|
||||
{% trans "DNS" %}
|
||||
</div>
|
||||
<div class="tile-content-wrapper">
|
||||
<i class="glyph-icon icon-dashboard"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4">
|
||||
<a href="{% url 'loadFTPHome' %}" title="{% trans 'FTP Functions' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<span class="bs-badge badge-absolute">2</span>
|
||||
<div class="tile-header">
|
||||
{% trans "FTP" %}
|
||||
</div>
|
||||
<div class="tile-content-wrapper">
|
||||
<i class="glyph-icon icon-dashboard"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<a href="{% url 'loadBackupHome' %}" title="{% trans 'Back up' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<span class="bs-badge badge-absolute">2</span>
|
||||
<div class="tile-header">
|
||||
{% trans "Back up" %}
|
||||
</div>
|
||||
<div class="tile-content-wrapper">
|
||||
<i class="glyph-icon icon-dashboard"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
|
||||
|
||||
<div class="col-md-4">
|
||||
<a href="{% url 'loadEmailHome' %}" title="{% trans 'Emails' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<span class="bs-badge badge-absolute">4</span>
|
||||
<div class="tile-header">
|
||||
{% trans "Emails" %}
|
||||
</div>
|
||||
<div class="tile-content-wrapper">
|
||||
<i class="glyph-icon icon-dashboard"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!--- If type is user--->
|
||||
|
||||
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@
|
|||
<i class="glyph-icon icon-linecons-tv"></i>
|
||||
<span>{% trans "Dashboard" %}</span>
|
||||
</a>
|
||||
<a id="versionManagement" href="{% url 'versionManagment' %}" title="{% trans 'Version Management' %}">
|
||||
<a class="versionManagement" href="{% url 'versionManagment' %}" title="{% trans 'Version Management' %}">
|
||||
<i class="glyph-icon tooltip-button icon-cloud-upload" title="{% trans 'Version Management' %}" data-original-title=".icon-cloud-upload" aria-describedby="tooltip896208"></i>
|
||||
<span>{% trans "Version Management" %}</span>
|
||||
</a>
|
||||
|
|
@ -302,15 +302,19 @@
|
|||
|
||||
<ul>
|
||||
<li><a href="{% url 'viewProfile' %}" title="{% trans 'View Profile' %}"><span>{% trans "View Profile" %}</span></a></li>
|
||||
<li id="normalUser"><a href="{% url 'createUser' %}" title="{% trans 'Create New User' %}"><span>{% trans "Create New User" %}</span></a></li>
|
||||
<li class="createNewUser"><a href="{% url 'createUser' %}" title="{% trans 'Create New User' %}"><span>{% trans "Create New User" %}</span></a></li>
|
||||
<li><a href="{% url 'modifyUsers' %}" title="{% trans 'Modify User' %}"><span>{% trans "Modify User" %}</span></a></li>
|
||||
<li id="normalUserB"><a href="{% url 'deleteUser' %}" title="{% trans 'Delete User' %}"><span>{% trans "Delete User" %}</span></a></li>
|
||||
<li class="deleteUser"><a href="{% url 'deleteUser' %}" title="{% trans 'Delete User' %}"><span>{% trans "Delete User" %}</span></a></li>
|
||||
<li class="resellerCenter"><a href="{% url 'resellerCenter' %}" title="{% trans 'Reseller Center' %}"><span>{% trans "Reseller Center" %}</span></a></li>
|
||||
<li class="changeUserACL"><a href="{% url 'changeUserACL' %}" title="{% trans 'Change User ACL' %}"><span>{% trans "Change User ACL" %}</span></a></li>
|
||||
<li class="serverACL"><a href="{% url 'createNewACL' %}" title="{% trans 'Create New ACL' %}"><span>{% trans "Create New ACL" %}</span></a></li>
|
||||
<li class="serverACL"><a href="{% url 'deleteACL' %}" title="{% trans 'Delete ACL' %}"><span>{% trans "Delete ACL" %}</span></a></li>
|
||||
<li class="serverACL"><a href="{% url 'modifyACL' %}" title="{% trans 'Modify ACL' %}"><span>{% trans "Modify ACL" %}</span></a></li>
|
||||
</ul>
|
||||
|
||||
</div><!-- .sidebar-submenu -->
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<a href="{% url 'loadWebsitesHome' %}" title="{% trans 'Websites' %}">
|
||||
<div class="glyph-icon icon-file-word-o" title="{% trans 'Websites' %}"></div>
|
||||
|
|
@ -319,11 +323,11 @@
|
|||
<div class="sidebar-submenu">
|
||||
|
||||
<ul>
|
||||
<li id="createWebsite"><a href="{% url 'createWebsite' %}" title="{% trans 'Create Website' %}"><span>{% trans "Create Website" %}</span></a></li>
|
||||
<li ><a href="{% url 'listWebsites' %}" title="{% trans 'List Websites' %}"><span>{% trans "List Websites" %}</span></a></li>
|
||||
<li id="modifyWebSite"><a href="{% url 'modifyWebsite' %}" title="{% trans 'Modify Website' %}"><span>{% trans "Modify Website" %}</span></a></li>
|
||||
<li id="siteState"><a href="{% url 'siteState' %}" title="{% trans 'Suspend/Unsuspend' %}"><span>{% trans "Suspend/Unsuspend" %}</span></a></li>
|
||||
<li id="deleteWebsite"><a href="{% url 'deleteWebsite' %}" title="{% trans 'Delete Website' %}"><span>{% trans "Delete Website" %}</span></a></li>
|
||||
<li class="createWebsite"><a href="{% url 'createWebsite' %}" title="{% trans 'Create Website' %}"><span>{% trans "Create Website" %}</span></a></li>
|
||||
<li><a href="{% url 'listWebsites' %}" title="{% trans 'List Websites' %}"><span>{% trans "List Websites" %}</span></a></li>
|
||||
<li class="modifyWebsite"><a href="{% url 'modifyWebsite' %}" title="{% trans 'Modify Website' %}"><span>{% trans "Modify Website" %}</span></a></li>
|
||||
<li class="suspendWebsite"><a href="{% url 'siteState' %}" title="{% trans 'Suspend/Unsuspend' %}"><span>{% trans "Suspend/Unsuspend" %}</span></a></li>
|
||||
<li class="deleteWebsite"><a href="{% url 'deleteWebsite' %}" title="{% trans 'Delete Website' %}"><span>{% trans "Delete Website" %}</span></a></li>
|
||||
</ul>
|
||||
|
||||
</div><!-- .sidebar-submenu -->
|
||||
|
|
@ -336,25 +340,25 @@
|
|||
<div id="packageSub" class="sidebar-submenu">
|
||||
|
||||
<ul>
|
||||
<li id="createPackage"><a href="{% url 'createPackage' %}" title="{% trans 'Create Package' %}"><span>{% trans "Create Package" %}</span></a></li>
|
||||
<li id="deletePackage"><a href="{% url 'deletePackage' %}" title="{% trans 'Delete Package' %}"><span>{% trans "Delete Package" %}</span></a></li>
|
||||
<li id="modifyPackage"><a href="{% url 'modifyPackage' %}" title="{% trans 'Modify Package' %}"><span>{% trans "Modify Package" %}</span></a></li>
|
||||
<li class="createPackage"><a href="{% url 'createPackage' %}" title="{% trans 'Create Package' %}"><span>{% trans "Create Package" %}</span></a></li>
|
||||
<li class="deletePackage"><a href="{% url 'deletePackage' %}" title="{% trans 'Delete Package' %}"><span>{% trans "Delete Package" %}</span></a></li>
|
||||
<li class="modifyPackage"><a href="{% url 'modifyPackage' %}" title="{% trans 'Modify Package' %}"><span>{% trans "Modify Package" %}</span></a></li>
|
||||
</ul>
|
||||
|
||||
</div><!-- .sidebar-submenu -->
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="{% url 'packagesHome' %}" title="{% trans 'Databases' %}">
|
||||
<a title="{% trans 'Databases' %}">
|
||||
<i class="glyph-icon icon-database" title="{% trans 'Databases' %}"></i>
|
||||
<span>{% trans "Databases" %}</span>
|
||||
</a>
|
||||
<div class="sidebar-submenu">
|
||||
|
||||
<ul>
|
||||
<li><a href="{% url 'createDatabase' %}" title="{% trans 'Create Database' %}"><span>{% trans "Create Database" %}</span></a></li>
|
||||
<li><a href="{% url 'deleteDatabase' %}" title="{% trans 'Delete Database' %}"><span>{% trans "Delete Database" %}</span></a></li>
|
||||
<li><a href="{% url 'listDBs' %}" title="{% trans 'List Databases' %}"><span>{% trans "List Databases" %}</span></a></li>
|
||||
<li class="createDatabase"><a href="{% url 'createDatabase' %}" title="{% trans 'Create Database' %}"><span>{% trans "Create Database" %}</span></a></li>
|
||||
<li class="deleteDatabase"><a href="{% url 'deleteDatabase' %}" title="{% trans 'Delete Database' %}"><span>{% trans "Delete Database" %}</span></a></li>
|
||||
<li class="listDatabases"><a href="{% url 'listDBs' %}" title="{% trans 'List Databases' %}"><span>{% trans "List Databases" %}</span></a></li>
|
||||
<li><a href="/phpmyadmin/index.php" title="{% trans 'PHPMYAdmin' %}" target="_blank"><span>{% trans "PHPMYAdmin" %}</span></a></li>
|
||||
<!----<li><a href="{% url 'modifyPackage' %}" title="Change Password"><span>Change Password</span></a></li>--->
|
||||
</ul>
|
||||
|
|
@ -362,26 +366,24 @@
|
|||
</div><!-- .sidebar-submenu -->
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="{% url 'packagesHome' %}" title="{% trans 'DNS' %}">
|
||||
<li>
|
||||
<a title="{% trans 'DNS' %}">
|
||||
<i class="glyph-icon icon-linecons-lightbulb"></i>
|
||||
<span>{% trans "DNS" %}</span>
|
||||
</a>
|
||||
<div class="sidebar-submenu">
|
||||
|
||||
<ul>
|
||||
<li id="normalUserC"><a href="{% url 'createNameserver' %}" title="{% trans 'Create Nameserver' %}"><span>{% trans "Create Nameserver" %}</span></a></li>
|
||||
<li><a href="{% url 'createDNSZone' %}" title="{% trans 'Create DNS Zone' %}"><span>{% trans "Create DNS Zone" %}</span></a></li>
|
||||
<li><a href="{% url 'deleteDNSZone' %}" title="{% trans 'Delete Zone' %}"><span>{% trans "Delete Zone" %}</span></a></li>
|
||||
<li><a href="{% url 'addDeleteDNSRecords' %}" title="{% trans 'Add/Delete Records' %}"><span>{% trans "Add/Delete Records" %}</span></a></li>
|
||||
<li class="createNameServer"><a href="{% url 'createNameserver' %}" title="{% trans 'Create Nameserver' %}"><span>{% trans "Create Nameserver" %}</span></a></li>
|
||||
<li class="createDNSZone"><a href="{% url 'createDNSZone' %}" title="{% trans 'Create DNS Zone' %}"><span>{% trans "Create DNS Zone" %}</span></a></li>
|
||||
<li class="deleteZone"><a href="{% url 'deleteDNSZone' %}" title="{% trans 'Delete Zone' %}"><span>{% trans "Delete Zone" %}</span></a></li>
|
||||
<li class="addDeleteRecords"><a href="{% url 'addDeleteDNSRecords' %}" title="{% trans 'Add/Delete Records' %}"><span>{% trans "Add/Delete Records" %}</span></a></li>
|
||||
</ul>
|
||||
|
||||
</div><!-- .sidebar-submenu -->
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<li>
|
||||
<a href="{% url 'loadEmailHome' %}" title="{% trans 'Email' %}">
|
||||
<i class="glyph-icon icon-linecons-mail"></i>
|
||||
<span>{% trans "Email" %}</span>
|
||||
|
|
@ -389,11 +391,11 @@
|
|||
<div class="sidebar-submenu">
|
||||
|
||||
<ul>
|
||||
<li id="normalUserC"><a href="{% url 'createEmailAccount' %}" title="{% trans 'Create Email Account' %}"><span>{% trans "Create Email" %}</span></a></li>
|
||||
<li><a href="{% url 'deleteEmailAccount' %}" title="{% trans 'Delete Email Account' %}"><span>{% trans "Delete Email" %}</span></a></li>
|
||||
<li><a href="{% url 'emailForwarding' %}" title="{% trans 'Email Forwarding' %}"><span>{% trans "Email Forwarding" %}</span></a></li>
|
||||
<li><a href="{% url 'changeEmailAccountPassword' %}" title="{% trans 'Change Password' %}"><span>{% trans "Change Password" %}</span></a></li>
|
||||
<li><a href="{% url 'dkimManager' %}" title="{% trans 'DKIM Manager' %}"><span>{% trans "DKIM Manager" %}</span></a></li>
|
||||
<li class="createEmail"><a href="{% url 'createEmailAccount' %}" title="{% trans 'Create Email Account' %}"><span>{% trans "Create Email" %}</span></a></li>
|
||||
<li class="deleteEmail"><a href="{% url 'deleteEmailAccount' %}" title="{% trans 'Delete Email Account' %}"><span>{% trans "Delete Email" %}</span></a></li>
|
||||
<li class="emailForwarding"><a href="{% url 'emailForwarding' %}" title="{% trans 'Email Forwarding' %}"><span>{% trans "Email Forwarding" %}</span></a></li>
|
||||
<li class="changeEmailPassword"><a href="{% url 'changeEmailAccountPassword' %}" title="{% trans 'Change Password' %}"><span>{% trans "Change Password" %}</span></a></li>
|
||||
<li class="dkimManager"><a href="{% url 'dkimManager' %}" title="{% trans 'DKIM Manager' %}"><span>{% trans "DKIM Manager" %}</span></a></li>
|
||||
<li><a href="/rainloop/index.php" title="{% trans 'Access Webmail' %}" target="_blank"><span>{% trans "Access Webmail" %}</span></a></li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -401,11 +403,7 @@
|
|||
</div><!-- .sidebar-submenu -->
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<li>
|
||||
<a href="{% url 'packagesHome' %}" title="{% trans 'FTP' %}">
|
||||
<i class="glyph-icon icon-paper-plane"></i>
|
||||
<span>{% trans "FTP" %}</span>
|
||||
|
|
@ -413,16 +411,14 @@
|
|||
<div class="sidebar-submenu">
|
||||
|
||||
<ul>
|
||||
<li><a href="{% url 'createFTPAccount' %}" title="{% trans 'Create FTP Account' %}"><span>{% trans "Create FTP Account" %}</span></a></li>
|
||||
<li><a href="{% url 'deleteFTPAccount' %}" title="{% trans 'Delete FTP Account' %}"><span>{% trans "Delete FTP Account" %}</span></a></li>
|
||||
<li><a href="{% url 'listFTPAccounts' %}" title="{% trans 'List FTP Accounts' %}"><span>{% trans "List FTP Accounts" %}</span></a></li>
|
||||
<li class="createFTPAccount"><a href="{% url 'createFTPAccount' %}" title="{% trans 'Create FTP Account' %}"><span>{% trans "Create FTP Account" %}</span></a></li>
|
||||
<li class="deleteFTPAccount"><a href="{% url 'deleteFTPAccount' %}" title="{% trans 'Delete FTP Account' %}"><span>{% trans "Delete FTP Account" %}</span></a></li>
|
||||
<li class="listFTPAccounts"><a href="{% url 'listFTPAccounts' %}" title="{% trans 'List FTP Accounts' %}"><span>{% trans "List FTP Accounts" %}</span></a></li>
|
||||
</ul>
|
||||
|
||||
</div><!-- .sidebar-submenu -->
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="{% url 'loadBackupHome' %}" title="{% trans 'Back up' %}">
|
||||
<i class="glyph-icon tooltip-button icon-folder" title=".icon-folder"></i>
|
||||
|
|
@ -431,11 +427,11 @@
|
|||
<div class="sidebar-submenu">
|
||||
|
||||
<ul>
|
||||
<li><a href="{% url 'backupSite' %}" title="{% trans 'Create Back up' %}"><span>{% trans "Create Back up" %}</span></a></li>
|
||||
<li id="restoreSite"><a href="{% url 'restoreSite' %}" title="{% trans 'Restore Back up' %}"><span>{% trans "Restore Back up" %}</span></a></li>
|
||||
<li id="backupDestinations"><a href="{% url 'backupDestinations' %}" title="{% trans 'Add Destination' %}"><span>{% trans "Add/Delete Destination" %}</span></a></li>
|
||||
<li id="scheduleBackup"><a href="{% url 'scheduleBackup' %}" title="{% trans 'Schedule Back up' %}"><span>{% trans "Schedule Back up" %}</span></a></li>
|
||||
<li id="remoteBackups"><a href="{% url 'remoteBackups' %}" title="{% trans 'Remote Back ups' %}"><span>{% trans "Remote Back ups" %}</span></a></li>
|
||||
<li class="createBackup"><a href="{% url 'backupSite' %}" title="{% trans 'Create Back up' %}"><span>{% trans "Create Back up" %}</span></a></li>
|
||||
<li class="restoreBackup"><a href="{% url 'restoreSite' %}" title="{% trans 'Restore Back up' %}"><span>{% trans "Restore Back up" %}</span></a></li>
|
||||
<li class="addDeleteDestinations"><a href="{% url 'backupDestinations' %}" title="{% trans 'Add Destination' %}"><span>{% trans "Add/Delete Destination" %}</span></a></li>
|
||||
<li class="scheDuleBackups"><a href="{% url 'scheduleBackup' %}" title="{% trans 'Schedule Back up' %}"><span>{% trans "Schedule Back up" %}</span></a></li>
|
||||
<li class="remoteBackups"><a href="{% url 'remoteBackups' %}" title="{% trans 'Remote Back ups' %}"><span>{% trans "Remote Back ups" %}</span></a></li>
|
||||
</ul>
|
||||
|
||||
</div><!-- .sidebar-submenu -->
|
||||
|
|
@ -450,18 +446,17 @@
|
|||
<div class="sidebar-submenu">
|
||||
|
||||
<ul>
|
||||
<li><a href="{% url 'manageSSL' %}" title="{% trans 'Manage SSL' %}"><span>{% trans "Manage SSL" %}</span></a></li>
|
||||
<li id="sslA"><a href="{% url 'sslForHostName' %}" title="{% trans 'Hostname SSL' %}"><span>{% trans "Hostname SSL" %}</span></a></li>
|
||||
<li id="sslA"><a href="{% url 'sslForMailServer' %}" title="{% trans 'MailServer SSL' %}"><span>{% trans "MailServer SSL" %}</span></a></li>
|
||||
<li class="manageSSL"><a href="{% url 'manageSSL' %}" title="{% trans 'Manage SSL' %}"><span>{% trans "Manage SSL" %}</span></a></li>
|
||||
<li class="hostnameSSL"><a href="{% url 'sslForHostName' %}" title="{% trans 'Hostname SSL' %}"><span>{% trans "Hostname SSL" %}</span></a></li>
|
||||
<li class="mailServerSSL"><a href="{% url 'sslForMailServer' %}" title="{% trans 'MailServer SSL' %}"><span>{% trans "MailServer SSL" %}</span></a></li>
|
||||
</ul>
|
||||
|
||||
</div><!-- .sidebar-submenu -->
|
||||
</li>
|
||||
|
||||
<li class="header serverACL"><span>{% trans "Server" %}</span></li>
|
||||
|
||||
|
||||
<li id="normalUserD" class="header"><span>{% trans "Server" %}</span></li>
|
||||
<li id="normalUserE">
|
||||
<li class="serverACL">
|
||||
<a href="#" title="{% trans 'Tuning' %}">
|
||||
<i class="glyph-icon icon-linecons-fire"></i>
|
||||
<span>{% trans "Tuning" %}</span>
|
||||
|
|
@ -476,7 +471,7 @@
|
|||
</div><!-- .sidebar-submenu -->
|
||||
</li>
|
||||
|
||||
<li id="normalUserF">
|
||||
<li class="serverACL">
|
||||
<a href="#" title="{% trans 'Server Status' %}">
|
||||
<i class="glyph-icon icon-linecons-fire"></i>
|
||||
<span>{% trans "Server Status" %}</span>
|
||||
|
|
@ -495,8 +490,7 @@
|
|||
</div><!-- .sidebar-submenu -->
|
||||
</li>
|
||||
|
||||
|
||||
<li id="normalUserP">
|
||||
<li class="serverACL">
|
||||
<a href="{% url 'loadPHPHome' %}" title="{% trans 'PHP' %}">
|
||||
<i class="files-icon glyph-icon icon-file-code-o"></i>
|
||||
<span>{% trans "PHP" %}</span>
|
||||
|
|
@ -511,8 +505,7 @@
|
|||
</div><!-- .sidebar-submenu -->
|
||||
</li>
|
||||
|
||||
|
||||
<li id="normalUserG">
|
||||
<li class="serverACL">
|
||||
<a href="{% url 'logsHome' %}" title="{% trans 'Server Status' %}">
|
||||
<i class="glyph-icon icon-linecons-fire"></i>
|
||||
<span>{% trans "Logs" %}</span>
|
||||
|
|
@ -530,8 +523,7 @@
|
|||
</div><!-- .sidebar-submenu -->
|
||||
</li>
|
||||
|
||||
|
||||
<li id="normalUserH">
|
||||
<li class="serverACL">
|
||||
<a href="{% url 'securityHome' %}" title="{% trans 'Security' %}">
|
||||
<i class="glyph-icon icon-linecons-fire"></i>
|
||||
<span>{% trans "Security" %}</span>
|
||||
|
|
@ -550,7 +542,7 @@
|
|||
</div><!-- .sidebar-submenu -->
|
||||
</li>
|
||||
|
||||
<li id="normalUserI">
|
||||
<li class="serverACL">
|
||||
<a href="#" title="{% trans 'Mail Settings' %}">
|
||||
<i class="glyph-icon icon-linecons-fire"></i>
|
||||
<span>{% trans "Mail Settings" %}</span>
|
||||
|
|
@ -567,8 +559,7 @@
|
|||
</div><!-- .sidebar-submenu -->
|
||||
</li>
|
||||
|
||||
|
||||
<li id="normalUserJ">
|
||||
<li class="serverACL">
|
||||
<a href="#" title="{% trans 'Manage Services' %}">
|
||||
<i class="glyph-icon icon-linecons-fire"></i>
|
||||
<span>{% trans "Manage Services" %}</span>
|
||||
|
|
@ -584,10 +575,8 @@
|
|||
</div><!-- .sidebar-submenu -->
|
||||
</li>
|
||||
|
||||
|
||||
</ul><!-- #sidebar-menu -->
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -53,37 +53,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{% if active == 1 %}
|
||||
|
||||
<div ng-hide="dbDetails" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" ng-click="upgrade()" class="btn btn-primary btn-lg btn-block">Upgrade</button>
|
||||
</div>
|
||||
<img ng-hide="upgradeLoading" src="{% static 'images/loading.gif' %}">
|
||||
<div style="margin-top: 2%" class="col-sm-12">
|
||||
<div ng-hide="updateError" class="alert alert-danger">
|
||||
<p>{% trans "Error message: " %}{$ errorMessage $}</p>
|
||||
</div>
|
||||
|
||||
<div ng-hide="updateStarted" class="alert alert-success">
|
||||
<p>{% trans "Update started..." %}</p>
|
||||
</div>
|
||||
|
||||
<div ng-hide="updateFinish" class="alert alert-success">
|
||||
<p>{% trans "Update finished..." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="couldNotConnect" class="alert alert-danger">
|
||||
<p>{% trans "Could not connect. Please refresh this page." %}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
<div ng-hide="upgradelogBox" class="form-group">
|
||||
<div class="col-sm-12">
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from __future__ import unicode_literals
|
|||
from django.shortcuts import render,redirect
|
||||
from django.http import HttpResponse
|
||||
from plogical.getSystemInformation import SystemInformation
|
||||
from loginSystem.models import Administrator
|
||||
from loginSystem.models import Administrator, ACL
|
||||
import json
|
||||
from loginSystem.views import loadLoginPage
|
||||
import re
|
||||
|
|
@ -14,67 +14,44 @@ import subprocess
|
|||
import shlex
|
||||
import os
|
||||
import plogical.CyberCPLogFileWriter as logging
|
||||
from plogical.virtualHostUtilities import virtualHostUtilities
|
||||
from plogical.acl import ACLManager
|
||||
# Create your views here.
|
||||
|
||||
|
||||
def renderBase(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
if currentACL['admin'] == 1:
|
||||
admin = 1
|
||||
else:
|
||||
admin = 0
|
||||
|
||||
cpuRamDisk = SystemInformation.cpuRamDisk()
|
||||
|
||||
finaData = {"type": admin.type,'ramUsage':cpuRamDisk['ramUsage'],'cpuUsage':cpuRamDisk['cpuUsage'],'diskUsage':cpuRamDisk['diskUsage'] }
|
||||
finaData = {"admin": admin,'ramUsage':cpuRamDisk['ramUsage'],'cpuUsage':cpuRamDisk['cpuUsage'],'diskUsage':cpuRamDisk['diskUsage'] }
|
||||
|
||||
return render(request, 'baseTemplate/homePage.html', finaData)
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def getAdminStatus(request):
|
||||
try:
|
||||
admin = request.session['userID']
|
||||
|
||||
administrator = Administrator.objects.get(pk=admin)
|
||||
|
||||
if administrator.type == 1:
|
||||
admin_type = "Administrator"
|
||||
elif administrator.type == 2:
|
||||
admin_type = "Reseller"
|
||||
else:
|
||||
admin_type = "Normal User"
|
||||
|
||||
# read server IP
|
||||
|
||||
try:
|
||||
ipFile = "/etc/cyberpanel/machineIP"
|
||||
f = open(ipFile)
|
||||
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[:3]
|
||||
|
||||
adminData = {"admin_type":admin_type,"user_name":adminName,"serverIPAddress":serverIPAddress}
|
||||
|
||||
json_data = json.dumps(adminData)
|
||||
val = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(val)
|
||||
|
||||
json_data = json.dumps(currentACL)
|
||||
return HttpResponse(json_data)
|
||||
except KeyError:
|
||||
return HttpResponse("Can not get admin Status")
|
||||
|
||||
|
||||
def getSystemStatus(request):
|
||||
try:
|
||||
|
||||
HTTPData = SystemInformation.getSystemInformation()
|
||||
json_data = json.dumps(HTTPData)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except KeyError:
|
||||
return HttpResponse("Can not get admin Status")
|
||||
|
||||
|
|
@ -91,38 +68,35 @@ def getLoadAverage(request):
|
|||
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def versionManagment(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if admin.type == 1:
|
||||
vers = version.objects.get(pk=1)
|
||||
|
||||
getVersion = requests.get('https://cyberpanel.net/version.txt')
|
||||
|
||||
latest = getVersion.json()
|
||||
|
||||
latestVersion = latest['version']
|
||||
latestBuild = latest['build']
|
||||
|
||||
if vers.currentVersion == latestVersion and vers.build == latestBuild:
|
||||
active = 0
|
||||
else:
|
||||
active = 0
|
||||
|
||||
return render(request, 'baseTemplate/versionManagment.html', {'build':vers.build,
|
||||
'currentVersion':vers.currentVersion,
|
||||
'latestVersion':latestVersion,'latestBuild':latestBuild,"active":active})
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['versionManagement'] == 1:
|
||||
pass
|
||||
else:
|
||||
return HttpResponse("You need to be admiministrator to view this page.")
|
||||
return ACLManager.loadError()
|
||||
|
||||
vers = version.objects.get(pk=1)
|
||||
|
||||
getVersion = requests.get('https://cyberpanel.net/version.txt')
|
||||
|
||||
latest = getVersion.json()
|
||||
|
||||
latestVersion = latest['version']
|
||||
latestBuild = latest['build']
|
||||
|
||||
return render(request, 'baseTemplate/versionManagment.html', {'build': vers.build,
|
||||
'currentVersion': vers.currentVersion,
|
||||
'latestVersion': latestVersion,
|
||||
'latestBuild': latestBuild})
|
||||
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
|
||||
def upgrade(request):
|
||||
try:
|
||||
admin = request.session['userID']
|
||||
|
|
@ -156,8 +130,6 @@ def upgrade(request):
|
|||
json_data = json.dumps(adminData)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
|
||||
def upgradeStatus(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
|
|
@ -206,7 +178,6 @@ def upgradeStatus(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def upgradeVersion(request):
|
||||
try:
|
||||
vers = version.objects.get(pk=1)
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ from models import Databases
|
|||
import json
|
||||
import shlex
|
||||
import subprocess
|
||||
from plogical.acl import ACLManager
|
||||
# Create your views here.
|
||||
|
||||
|
||||
|
|
@ -29,36 +30,19 @@ def loadDatabaseHome(request):
|
|||
|
||||
def createDatabase(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if admin.type == 1:
|
||||
websites = Websites.objects.all()
|
||||
websitesName = []
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['createDatabase'] == 1:
|
||||
pass
|
||||
else:
|
||||
if admin.type == 2:
|
||||
websites = Websites.objects.filter(admin=admin)
|
||||
admins = Administrator.objects.filter(owner=admin.pk)
|
||||
websitesName = []
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
|
||||
for items in admins:
|
||||
webs = Websites.objects.filter(admin=items)
|
||||
|
||||
for web in webs:
|
||||
websitesName.append(web.domain)
|
||||
else:
|
||||
websitesName = []
|
||||
websites = Websites.objects.filter(admin=admin)
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
return ACLManager.loadError()
|
||||
|
||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||
|
||||
return render(request, 'databases/createDatabase.html', {'websitesList':websitesName})
|
||||
except BaseException, msg:
|
||||
|
|
@ -68,11 +52,9 @@ def createDatabase(request):
|
|||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def submitDBCreation(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
|
|
@ -83,12 +65,14 @@ def submitDBCreation(request):
|
|||
dbPassword = data['dbPassword']
|
||||
webUsername = data['webUserName']
|
||||
|
||||
if admin.type != 1:
|
||||
website = Websites.objects.get(domain=databaseWebsite)
|
||||
if website.admin != admin:
|
||||
dic = {'createDBStatus': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['createDatabase'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('createDBStatus', 0)
|
||||
|
||||
dbName = webUsername+"_"+dbName
|
||||
dbUsername = webUsername+"_"+dbUsername
|
||||
|
|
@ -113,40 +97,21 @@ def submitDBCreation(request):
|
|||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def deleteDatabase(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if admin.type == 1:
|
||||
websites = Websites.objects.all()
|
||||
websitesName = []
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['deleteDatabase'] == 1:
|
||||
pass
|
||||
else:
|
||||
if admin.type == 2:
|
||||
websites = admin.websites_set.all()
|
||||
admins = Administrator.objects.filter(owner=admin.pk)
|
||||
websitesName = []
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
|
||||
for items in admins:
|
||||
webs = items.websites_set.all()
|
||||
|
||||
for web in webs:
|
||||
websitesName.append(web.domain)
|
||||
else:
|
||||
websitesName = []
|
||||
websites = Websites.objects.filter(admin=admin)
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
return ACLManager.loadError()
|
||||
|
||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||
|
||||
return render(request, 'databases/deleteDatabase.html', {'websitesList':websitesName})
|
||||
except BaseException, msg:
|
||||
|
|
@ -158,24 +123,21 @@ def deleteDatabase(request):
|
|||
|
||||
def fetchDatabases(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
|
||||
data = json.loads(request.body)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['deleteDatabase'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('fetchStatus', 0)
|
||||
|
||||
databaseWebsite = data['databaseWebsite']
|
||||
|
||||
if admin.type != 1:
|
||||
website = Websites.objects.get(domain=databaseWebsite)
|
||||
if website.admin != admin:
|
||||
dic = {'fetchStatus': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
website = Websites.objects.get(domain=databaseWebsite)
|
||||
|
||||
|
||||
databases = Databases.objects.filter(website=website)
|
||||
|
||||
json_data = "["
|
||||
|
|
@ -207,24 +169,22 @@ def fetchDatabases(request):
|
|||
final_json = json.dumps({'fetchStatus': 0, 'error_message': "Not logged in."})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def submitDatabaseDeletion(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
|
||||
data = json.loads(request.body)
|
||||
dbName = data['dbName']
|
||||
|
||||
if admin.type != 1:
|
||||
db = Databases.objects.get(dbName=dbName)
|
||||
if db.website.admin != admin:
|
||||
dic = {'deleteStatus': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['deleteDatabase'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('deleteStatus', 0)
|
||||
|
||||
result = mysqlUtilities.submitDBDeletion(dbName)
|
||||
|
||||
|
|
@ -247,38 +207,20 @@ def submitDatabaseDeletion(request):
|
|||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def listDBs(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if admin.type == 1:
|
||||
websites = Websites.objects.all()
|
||||
websitesName = []
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['listDatabases'] == 1:
|
||||
pass
|
||||
else:
|
||||
if admin.type == 2:
|
||||
websites = admin.websites_set.all()
|
||||
admins = Administrator.objects.filter(owner=admin.pk)
|
||||
websitesName = []
|
||||
return ACLManager.loadError()
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
|
||||
for items in admins:
|
||||
webs = items.websites_set.all()
|
||||
|
||||
for web in webs:
|
||||
websitesName.append(web.domain)
|
||||
else:
|
||||
websitesName = []
|
||||
websites = Websites.objects.filter(admin=admin)
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||
|
||||
return render(request, 'databases/listDataBases.html', {'websiteList':websitesName})
|
||||
except BaseException, msg:
|
||||
|
|
@ -288,11 +230,9 @@ def listDBs(request):
|
|||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def changePassword(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
|
|
@ -300,12 +240,14 @@ def changePassword(request):
|
|||
userName = data['dbUserName']
|
||||
dbPassword = data['dbPassword']
|
||||
|
||||
if admin.type != 1:
|
||||
db = Databases.objects.get(dbName=userName)
|
||||
if db.website.admin != admin:
|
||||
dic = {'changePasswordStatus': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['listDatabases'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('changePasswordStatus', 0)
|
||||
|
||||
passFile = "/etc/cyberpanel/mysqlPassword"
|
||||
|
||||
|
|
@ -337,4 +279,4 @@ def changePassword(request):
|
|||
except KeyError,msg:
|
||||
data_ret = {'changePasswordStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
return HttpResponse(json_data)
|
||||
|
|
|
|||
|
|
@ -288,8 +288,7 @@ app.controller('addModifyDNSRecords', function($scope,$http) {
|
|||
data.priority = $scope.priority;
|
||||
data.ttl = $scope.ttl;
|
||||
data.recordType = type;
|
||||
}
|
||||
else if(type === "CAA"){
|
||||
}else if(type === "CAA"){
|
||||
data.selectedZone = $scope.selectedZone;
|
||||
data.recordName = $scope.recordName;
|
||||
data.recordContentCAA = $scope.recordContentCAA;
|
||||
|
|
|
|||
|
|
@ -289,23 +289,17 @@
|
|||
|
||||
<!------------- SRV Record box ------------->
|
||||
|
||||
|
||||
<!------------- CAA Record box ------------->
|
||||
|
||||
|
||||
<div class="col-sm-3 caaRecord">
|
||||
<input placeholder="{% trans 'Name' %}" type="text" class="form-control" ng-model="recordName">
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3 caaRecord">
|
||||
<input placeholder="{% trans 'TTL' %}" type="number" class="form-control" ng-model="ttl" required>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3 caaRecord">
|
||||
<input placeholder='Value e.g: 0 issue "letsencrypt.org"' type="text" class="form-control" ng-model="recordContentCAA" required>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-sm-3 caaRecord">
|
||||
<button style="width: 100%;" type="button" ng-click="addDNSRecord('CAA')" class="btn btn-primary">{% trans "Add" %}</button>
|
||||
</div>
|
||||
|
|
|
|||
206
dns/views.py
206
dns/views.py
|
|
@ -12,6 +12,7 @@ from models import Domains,Records
|
|||
from re import match,I,M
|
||||
from websiteFunctions.models import Websites
|
||||
from plogical.mailUtilities import mailUtilities
|
||||
from plogical.acl import ACLManager
|
||||
|
||||
# Create your views here.
|
||||
|
||||
|
|
@ -27,10 +28,15 @@ def loadDNSHome(request):
|
|||
def createNameserver(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough priviliges to access this page.")
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['createNameServer'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
mailUtilities.checkHome()
|
||||
|
||||
|
|
@ -46,15 +52,19 @@ def createNameserver(request):
|
|||
|
||||
def NSCreation(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'NSCreation': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['createNameServer'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('NSCreation', 0)
|
||||
|
||||
|
||||
data = json.loads(request.body)
|
||||
|
|
@ -136,7 +146,6 @@ def NSCreation(request):
|
|||
final_dic = {'NSCreation': 1, 'error_message': "None"}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
else:
|
||||
|
||||
newZone = Domains.objects.get(name=domainForNS)
|
||||
|
|
@ -194,8 +203,6 @@ def NSCreation(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
final_dic = {'NSCreation': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
|
|
@ -206,11 +213,18 @@ def NSCreation(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def createDNSZone(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['createDNSZone'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
if os.path.exists('/home/cyberpanel/powerdns'):
|
||||
return render(request,'dns/createDNSZone.html', {"status": 1})
|
||||
|
|
@ -222,11 +236,19 @@ def createDNSZone(request):
|
|||
|
||||
def zoneCreation(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['createDNSZone'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('zoneCreation', 0)
|
||||
|
||||
data = json.loads(request.body)
|
||||
zoneDomain = data['zoneDomain']
|
||||
|
|
@ -250,11 +272,8 @@ def zoneCreation(request):
|
|||
|
||||
final_dic = {'zoneCreation': 1}
|
||||
final_json = json.dumps(final_dic)
|
||||
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
|
||||
except BaseException,msg:
|
||||
|
||||
final_dic = {'zoneCreation': 0, 'error_message': str(msg)}
|
||||
|
|
@ -267,31 +286,23 @@ def zoneCreation(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def addDeleteDNSRecords(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
domainsList = []
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['addDeleteRecords'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
if not os.path.exists('/home/cyberpanel/powerdns'):
|
||||
return render(request,'dns/addDeleteDNSRecords.html', {"status": 0})
|
||||
|
||||
if admin.type == 1:
|
||||
domains = Domains.objects.all()
|
||||
for items in domains:
|
||||
domainsList.append(items.name)
|
||||
else:
|
||||
websites = admin.websites_set.all()
|
||||
|
||||
for web in websites:
|
||||
try:
|
||||
tempDomain = Domains.objects.get(name = web.domain)
|
||||
domainsList.append(web.domain)
|
||||
except:
|
||||
pass
|
||||
|
||||
domainsList = ACLManager.findAllDomains(currentACL, userID)
|
||||
|
||||
return render(request, 'dns/addDeleteDNSRecords.html',{"domainsList":domainsList, "status": 1})
|
||||
|
||||
|
|
@ -300,8 +311,7 @@ def addDeleteDNSRecords(request):
|
|||
|
||||
def getCurrentRecordsForDomain(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
|
|
@ -309,16 +319,20 @@ def getCurrentRecordsForDomain(request):
|
|||
zoneDomain = data['selectedZone']
|
||||
currentSelection = data['currentSelection']
|
||||
|
||||
if admin.type != 1:
|
||||
website = Websites.objects.get(domain=zoneDomain)
|
||||
if website.admin != admin:
|
||||
dic = {'fetchStatus': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['addDeleteRecords'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('fetchStatus', 1)
|
||||
|
||||
if not os.path.exists('/home/cyberpanel/powerdns'):
|
||||
return render(request, 'dns/addDeleteDNSRecords.html', {"status": 0})
|
||||
|
||||
|
||||
domain = Domains.objects.get(name=zoneDomain)
|
||||
|
||||
records = Records.objects.filter(domain_id=domain.id)
|
||||
|
||||
|
||||
|
|
@ -383,11 +397,9 @@ def getCurrentRecordsForDomain(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def addDNSRecord(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
|
|
@ -397,12 +409,15 @@ def addDNSRecord(request):
|
|||
recordName = data['recordName']
|
||||
ttl = int(data['ttl'])
|
||||
|
||||
if admin.type != 1:
|
||||
website = Websites.objects.get(domain=zoneDomain)
|
||||
if website.admin != admin:
|
||||
dic = {'add_status': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['addDeleteRecords'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('add_status', 0)
|
||||
|
||||
|
||||
zone = Domains.objects.get(name=zoneDomain)
|
||||
value = ""
|
||||
|
|
@ -530,18 +545,17 @@ def addDNSRecord(request):
|
|||
priority = data['priority']
|
||||
|
||||
DNS.createDNSRecord(zone, value, recordType, recordContentSRV, priority, ttl)
|
||||
elif recordType == "CAA":
|
||||
|
||||
elif recordType == "CAA":
|
||||
if recordName == "@":
|
||||
value = zoneDomain
|
||||
## re.match
|
||||
elif match(r'([\da-z\.-]+\.[a-z\.]{2,12}|[\d\.]+)([\/:?=&#]{1}[\da-z\.-]+)*[\/\?]?', recordName, M | I):
|
||||
elif match(r'([\da-z\.-]+\.[a-z\.]{2,12}|[\d\.]+)([\/:?=&#]{1}[\da-z\.-]+)*[\/\?]?', recordName,
|
||||
M | I):
|
||||
value = recordName
|
||||
else:
|
||||
value = recordName + "." + zoneDomain
|
||||
|
||||
recordContentCAA = data['recordContentCAA'] ## IP or ponting value
|
||||
|
||||
DNS.createDNSRecord(zone, value, recordType, recordContentCAA, 0, ttl)
|
||||
|
||||
|
||||
|
|
@ -559,32 +573,31 @@ def addDNSRecord(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def deleteDNSRecord(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
data = json.loads(request.body)
|
||||
id = data['id']
|
||||
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['addDeleteRecords'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('delete_status', 0)
|
||||
|
||||
delRecord = Records.objects.get(id=id)
|
||||
|
||||
if admin.type != 1:
|
||||
if delRecord.domainOwner.admin != admin:
|
||||
dic = {'delete_status': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
delRecord.delete()
|
||||
|
||||
final_dic = {'delete_status': 1, 'error_message': "None"}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
except BaseException,msg:
|
||||
final_dic = {'delete_status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
|
|
@ -594,57 +607,52 @@ def deleteDNSRecord(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def deleteDNSZone(request):
|
||||
|
||||
try:
|
||||
val = request.session['userID']
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
domainsList = []
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['deleteZone'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
if not os.path.exists('/home/cyberpanel/powerdns'):
|
||||
return render(request,'dns/deleteDNSZone.html', {"status": 0})
|
||||
|
||||
if admin.type == 1:
|
||||
domains = Domains.objects.all()
|
||||
for items in domains:
|
||||
domainsList.append(items.name)
|
||||
else:
|
||||
websites = admin.websites_set.all()
|
||||
|
||||
for web in websites:
|
||||
try:
|
||||
tempDomain = Domains.objects.get(name = web.domain)
|
||||
domainsList.append(web.domain)
|
||||
except:
|
||||
pass
|
||||
return render(request, 'dns/addDeleteDNSRecords.html', {"status": 0})
|
||||
|
||||
domainsList = ACLManager.findAllDomains(currentACL, userID)
|
||||
|
||||
return render(request, 'dns/deleteDNSZone.html',{"domainsList":domainsList, "status": 1})
|
||||
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def submitZoneDeletion(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
data = json.loads(request.body)
|
||||
zoneDomain = data['zoneDomain']
|
||||
|
||||
delZone = Domains.objects.get(name=zoneDomain)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if admin.type != 1:
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['deleteZone'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('delete_status', 0)
|
||||
|
||||
delZone = Domains.objects.get(name=zoneDomain)
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
if delZone.admin != admin:
|
||||
dic = {'delete_status': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
ACLManager.loadErrorJson()
|
||||
|
||||
delZone.delete()
|
||||
|
||||
|
|
|
|||
|
|
@ -19,22 +19,23 @@ import subprocess
|
|||
import shlex
|
||||
from plogical.virtualHostUtilities import virtualHostUtilities
|
||||
from random import randint
|
||||
|
||||
from plogical.acl import ACLManager
|
||||
|
||||
|
||||
# Create your views here.
|
||||
|
||||
def listDomains(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
try:
|
||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||
|
||||
if admin.type == 1:
|
||||
websites = DomainLimits.objects.all()
|
||||
else:
|
||||
return HttpResponse("Only administrator can view this page.")
|
||||
websites = DomainLimits.objects.all()
|
||||
|
||||
## Check if Policy Server is installed.
|
||||
|
||||
|
|
@ -53,8 +54,6 @@ def listDomains(request):
|
|||
|
||||
###
|
||||
|
||||
|
||||
|
||||
pages = float(len(websites)) / float(10)
|
||||
pagination = []
|
||||
|
||||
|
|
@ -80,10 +79,16 @@ def listDomains(request):
|
|||
|
||||
def getFurtherDomains(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
|
||||
try:
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if request.method == 'POST':
|
||||
try:
|
||||
|
|
@ -94,16 +99,9 @@ def getFurtherDomains(request):
|
|||
except BaseException, msg:
|
||||
status = str(msg)
|
||||
|
||||
|
||||
if admin.type == 1:
|
||||
finalPageNumber = ((pageNumber * 10))-10
|
||||
endPageNumber = finalPageNumber + 10
|
||||
websites = Websites.objects.all()[finalPageNumber:endPageNumber]
|
||||
|
||||
else:
|
||||
final_dic = {'listWebSiteStatus': 0, 'error_message': "Only administrator can view this page."}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
finalPageNumber = ((pageNumber * 10)) - 10
|
||||
endPageNumber = finalPageNumber + 10
|
||||
websites = Websites.objects.all()[finalPageNumber:endPageNumber]
|
||||
|
||||
json_data = "["
|
||||
checker = 0
|
||||
|
|
@ -143,18 +141,18 @@ def getFurtherDomains(request):
|
|||
|
||||
def enableDisableEmailLimits(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
|
||||
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
data = json.loads(request.body)
|
||||
operationVal = data['operationVal']
|
||||
domainName = data['domainName']
|
||||
|
|
@ -186,58 +184,52 @@ def enableDisableEmailLimits(request):
|
|||
|
||||
def emailLimits(request,domain):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||
|
||||
if admin.type != 1:
|
||||
return HttpResponse("Only administrator can view this page.")
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
|
||||
if Websites.objects.filter(domain=domain).exists():
|
||||
if admin.type == 1:
|
||||
website = Websites.objects.get(domain=domain)
|
||||
domainEmail = Domains.objects.get(domainOwner=website)
|
||||
domainLimits = DomainLimits.objects.get(domain=domainEmail)
|
||||
website = Websites.objects.get(domain=domain)
|
||||
domainEmail = Domains.objects.get(domainOwner=website)
|
||||
domainLimits = DomainLimits.objects.get(domain=domainEmail)
|
||||
|
||||
Data = {}
|
||||
Data['domain'] = domain
|
||||
Data['monthlyLimit'] = domainLimits.monthlyLimit
|
||||
Data['monthlyUsed'] = domainLimits.monthlyUsed
|
||||
Data['emailAccounts'] = domainEmail.eusers_set.count()
|
||||
Data = {}
|
||||
Data['domain'] = domain
|
||||
Data['monthlyLimit'] = domainLimits.monthlyLimit
|
||||
Data['monthlyUsed'] = domainLimits.monthlyUsed
|
||||
Data['emailAccounts'] = domainEmail.eusers_set.count()
|
||||
|
||||
if domainLimits.limitStatus == 1:
|
||||
Data['limitsOn'] = 1
|
||||
Data['limitsOff'] = 0
|
||||
else:
|
||||
Data['limitsOn'] = 0
|
||||
Data['limitsOff'] = 1
|
||||
|
||||
## Pagination for emails
|
||||
|
||||
|
||||
pages = float(Data['emailAccounts']) / float(10)
|
||||
pagination = []
|
||||
|
||||
if pages <= 1.0:
|
||||
pages = 1
|
||||
pagination.append('<li><a href="\#"></a></li>')
|
||||
else:
|
||||
pages = ceil(pages)
|
||||
finalPages = int(pages) + 1
|
||||
|
||||
for i in range(1, finalPages):
|
||||
pagination.append('<li><a href="\#">' + str(i) + '</a></li>')
|
||||
|
||||
Data['pagination'] = pagination
|
||||
|
||||
|
||||
return render(request, 'emailPremium/emailLimits.html', Data)
|
||||
if domainLimits.limitStatus == 1:
|
||||
Data['limitsOn'] = 1
|
||||
Data['limitsOff'] = 0
|
||||
else:
|
||||
return render(request, 'emailPremium/emailLimits.html',
|
||||
{"error": 1, "domain": "You do not own this domain."})
|
||||
Data['limitsOn'] = 0
|
||||
Data['limitsOff'] = 1
|
||||
|
||||
## Pagination for emails
|
||||
|
||||
|
||||
pages = float(Data['emailAccounts']) / float(10)
|
||||
pagination = []
|
||||
|
||||
if pages <= 1.0:
|
||||
pages = 1
|
||||
pagination.append('<li><a href="\#"></a></li>')
|
||||
else:
|
||||
pages = ceil(pages)
|
||||
finalPages = int(pages) + 1
|
||||
|
||||
for i in range(1, finalPages):
|
||||
pagination.append('<li><a href="\#">' + str(i) + '</a></li>')
|
||||
|
||||
Data['pagination'] = pagination
|
||||
|
||||
return render(request, 'emailPremium/emailLimits.html', Data)
|
||||
else:
|
||||
return render(request, 'emailPremium/emailLimits.html', {"error":1,"domain": "This domain does not exists"})
|
||||
except KeyError:
|
||||
|
|
@ -245,17 +237,16 @@ def emailLimits(request,domain):
|
|||
|
||||
def changeDomainLimit(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
data = json.loads(request.body)
|
||||
newLimit = data['newLimit']
|
||||
domainName = data['domainName']
|
||||
|
|
@ -286,15 +277,15 @@ def changeDomainLimit(request):
|
|||
|
||||
def getFurtherEmail(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
data = json.loads(request.body)
|
||||
status = data['page']
|
||||
|
|
@ -346,17 +337,16 @@ def getFurtherEmail(request):
|
|||
|
||||
def enableDisableIndividualEmailLimits(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
data = json.loads(request.body)
|
||||
operationVal = data['operationVal']
|
||||
emailAddress = data['emailAddress']
|
||||
|
|
@ -385,11 +375,13 @@ def enableDisableIndividualEmailLimits(request):
|
|||
|
||||
def emailPage(request, emailAddress):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if admin.type != 1:
|
||||
return HttpResponse("Only administrator can view this page.")
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
Data = {}
|
||||
Data['emailAddress'] = emailAddress
|
||||
|
|
@ -418,17 +410,16 @@ def emailPage(request, emailAddress):
|
|||
|
||||
def getEmailStats(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
data = json.loads(request.body)
|
||||
emailAddress = data['emailAddress']
|
||||
|
||||
|
|
@ -459,17 +450,16 @@ def getEmailStats(request):
|
|||
|
||||
def enableDisableIndividualEmailLogs(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
data = json.loads(request.body)
|
||||
operationVal = data['operationVal']
|
||||
emailAddress = data['emailAddress']
|
||||
|
|
@ -498,17 +488,16 @@ def enableDisableIndividualEmailLogs(request):
|
|||
|
||||
def changeDomainEmailLimitsIndividual(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
data = json.loads(request.body)
|
||||
emailAddress = data['emailAddress']
|
||||
monthlyLimit = data['monthlyLimit']
|
||||
|
|
@ -571,17 +560,16 @@ def changeDomainEmailLimitsIndividual(request):
|
|||
|
||||
def getEmailLogs(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
data = json.loads(request.body)
|
||||
status = data['page']
|
||||
emailAddress = data['emailAddress']
|
||||
|
|
@ -626,17 +614,16 @@ def getEmailLogs(request):
|
|||
|
||||
def flushEmailLogs(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
data = json.loads(request.body)
|
||||
emailAddress = data['emailAddress']
|
||||
|
||||
|
|
@ -664,11 +651,13 @@ def flushEmailLogs(request):
|
|||
|
||||
def spamAssassinHome(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if admin.type != 1:
|
||||
return HttpResponse("Only administrator can view this page.")
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
checkIfSpamAssassinInstalled = 0
|
||||
|
||||
|
|
@ -682,16 +671,14 @@ def spamAssassinHome(request):
|
|||
|
||||
def installSpamAssassin(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
try:
|
||||
|
||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
thread.start_new_thread(mailUtilities.installSpamAssassin, ('Install','SpamAssassin'))
|
||||
final_json = json.dumps({'status': 1, 'error_message': "None"})
|
||||
return HttpResponse(final_json)
|
||||
|
|
@ -706,17 +693,10 @@ def installSpamAssassin(request):
|
|||
|
||||
def installStatusSpamAssassin(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
command = "sudo cat " + mailUtilities.spamassassinInstallLogPath
|
||||
installStatus = subprocess.check_output(shlex.split(command))
|
||||
|
||||
|
|
@ -763,8 +743,6 @@ def installStatusSpamAssassin(request):
|
|||
'requestStatus': installStatus,
|
||||
})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
except BaseException,msg:
|
||||
final_dic = {'abort':1,'installed':0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
|
|
@ -774,19 +752,19 @@ def installStatusSpamAssassin(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def fetchSpamAssassinSettings(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('fetchStatus', 0)
|
||||
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'fetchStatus': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
report_safe = 0
|
||||
required_hits = '5.0'
|
||||
rewrite_header = 'Subject [SPAM]'
|
||||
|
|
@ -848,16 +826,16 @@ def fetchSpamAssassinSettings(request):
|
|||
|
||||
def saveSpamAssassinConfigurations(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('saveStatus', 0)
|
||||
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
data = json.loads(request.body)
|
||||
|
||||
report_safe = data['report_safe']
|
||||
|
|
@ -922,11 +900,13 @@ def saveSpamAssassinConfigurations(request):
|
|||
|
||||
def emailPolicyServer(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if admin.type != 1:
|
||||
return HttpResponse("Only administrator can view this page.")
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
return render(request, 'emailPremium/policyServer.html')
|
||||
|
||||
|
|
@ -935,16 +915,16 @@ def emailPolicyServer(request):
|
|||
|
||||
def fetchPolicyServerStatus(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
command = 'sudo cat /etc/postfix/main.cf'
|
||||
output = subprocess.check_output(shlex.split(command)).split('\n')
|
||||
|
||||
|
|
@ -974,16 +954,16 @@ def fetchPolicyServerStatus(request):
|
|||
|
||||
def savePolicyServerStatus(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
data = json.loads(request.body)
|
||||
|
||||
policServerStatus = data['policServerStatus']
|
||||
|
|
|
|||
|
|
@ -12,19 +12,20 @@ import subprocess
|
|||
import shlex
|
||||
import os
|
||||
from plogical.virtualHostUtilities import virtualHostUtilities
|
||||
|
||||
from plogical.acl import ACLManager
|
||||
|
||||
# Create your views here.
|
||||
|
||||
|
||||
def loadFileManagerHome(request,domain):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
if Websites.objects.filter(domain=domain).exists():
|
||||
if admin.type == 1:
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
if currentACL['admin'] == 1:
|
||||
viewStatus = 1
|
||||
if admin.type == 3:
|
||||
viewStatus = 0
|
||||
|
|
@ -102,17 +103,17 @@ def downloadFile(request):
|
|||
|
||||
def createTemporaryFile(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
|
||||
userID = request.session['userID']
|
||||
data = json.loads(request.body)
|
||||
domainName = data['domainName']
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
## Create file manager entry
|
||||
|
||||
if Websites.objects.filter(domain=domainName).exists():
|
||||
if admin.type == 1:
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
if currentACL['admin'] == 1:
|
||||
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/filemanager.py"
|
||||
|
||||
|
|
|
|||
|
|
@ -16,12 +16,21 @@ from plogical.installUtilities import installUtilities
|
|||
from random import randint
|
||||
from plogical.csf import CSF
|
||||
import time
|
||||
from plogical.acl import ACLManager
|
||||
# Create your views here.
|
||||
|
||||
|
||||
def securityHome(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
|
||||
return render(request,'firewall/index.html')
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
|
@ -29,29 +38,31 @@ def securityHome(request):
|
|||
def firewallHome(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough priviliges to access this page.")
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
return render(request,'firewall/firewall.html')
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def getCurrentRules(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('fetchStatus', 0)
|
||||
|
||||
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'fetchStatus': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
rules = FirewallRules.objects.all()
|
||||
|
||||
json_data = "["
|
||||
|
|
@ -86,19 +97,19 @@ def getCurrentRules(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def addRule(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('add_status', 0)
|
||||
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'add_status': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
data = json.loads(request.body)
|
||||
ruleName = data['ruleName']
|
||||
ruleProtocol = data['ruleProtocol']
|
||||
|
|
@ -125,19 +136,18 @@ def addRule(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def deleteRule(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('delete_status', 0)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'delete_status': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
data = json.loads(request.body)
|
||||
ruleID = data['id']
|
||||
ruleProtocol = data['proto']
|
||||
|
|
@ -153,7 +163,6 @@ def deleteRule(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
except BaseException,msg:
|
||||
final_dic = {'delete_status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
|
|
@ -163,19 +172,19 @@ def deleteRule(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def reloadFirewall(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('reload_status', 0)
|
||||
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'reload_status': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
command = 'sudo firewall-cmd --reload'
|
||||
cmd = shlex.split(command)
|
||||
res = subprocess.call(cmd)
|
||||
|
|
@ -189,9 +198,6 @@ def reloadFirewall(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
|
||||
|
||||
except BaseException,msg:
|
||||
final_dic = {'reload_status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
|
|
@ -201,19 +207,18 @@ def reloadFirewall(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def startFirewall(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('start_status', 0)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'start_status': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
command = 'sudo systemctl start firewalld'
|
||||
|
||||
cmd = shlex.split(command)
|
||||
|
|
@ -229,9 +234,6 @@ def startFirewall(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
|
||||
|
||||
except BaseException,msg:
|
||||
final_dic = {'start_status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
|
|
@ -241,19 +243,18 @@ def startFirewall(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def stopFirewall(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('stop_status', 0)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'stop_status': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
command = 'sudo systemctl stop firewalld'
|
||||
|
||||
cmd = shlex.split(command)
|
||||
|
|
@ -278,19 +279,18 @@ def stopFirewall(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def firewallStatus(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'status': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
status = subprocess.check_output(["systemctl", "status","firewalld"])
|
||||
|
||||
if status.find("active") >-1:
|
||||
|
|
@ -302,7 +302,6 @@ def firewallStatus(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
except BaseException,msg:
|
||||
final_dic = {'status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
|
|
@ -312,35 +311,35 @@ def firewallStatus(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def secureSSH(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough priviliges to access this page.")
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
return render(request,'firewall/secureSSH.html')
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def getSSHConfigs(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
data = json.loads(request.body)
|
||||
type = data['type']
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'status': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
if type=="1":
|
||||
|
||||
## temporarily changing permission for sshd files
|
||||
|
|
@ -428,9 +427,6 @@ def getSSHConfigs(request):
|
|||
|
||||
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
|
||||
except BaseException,msg:
|
||||
final_dic = {'status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
|
|
@ -440,22 +436,20 @@ def getSSHConfigs(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def saveSSHConfigs(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin= Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('saveStatus', 0)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
data = json.loads(request.body)
|
||||
type = data['type']
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'saveStatus': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
if type=="1":
|
||||
|
||||
sshPort = data['sshPort']
|
||||
|
|
@ -548,21 +542,20 @@ def saveSSHConfigs(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def deleteSSHKey(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('delete_status', 0)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
data = json.loads(request.body)
|
||||
key = data['key']
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'delete_status': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
# temp change of permissions
|
||||
|
||||
command = 'sudo chown -R cyberpanel:cyberpanel /root'
|
||||
|
|
@ -612,21 +605,21 @@ def deleteSSHKey(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def addSSHKey(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('add_status', 0)
|
||||
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
data = json.loads(request.body)
|
||||
key = data['key']
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'add_status': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
# temp change of permissions
|
||||
|
||||
command = 'sudo chown -R cyberpanel:cyberpanel /root'
|
||||
|
|
@ -688,11 +681,12 @@ def addSSHKey(request):
|
|||
def loadModSecurityHome(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough privileges to access this page.")
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
confPath = os.path.join(virtualHostUtilities.Server_root,"conf/httpd_config.conf")
|
||||
|
||||
|
|
@ -712,15 +706,15 @@ def loadModSecurityHome(request):
|
|||
|
||||
def installModSec(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('installModSec', 0)
|
||||
|
||||
try:
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'installModSec': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
thread.start_new_thread(modSec.installModSec, ('Install','modSec'))
|
||||
final_json = json.dumps({'installModSec': 1, 'error_message': "None"})
|
||||
return HttpResponse(final_json)
|
||||
|
|
@ -741,11 +735,6 @@ def installStatusModSec(request):
|
|||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'abort': 1, 'installed': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
installStatus = unicode(open(modSec.installLogPath, "r").read())
|
||||
|
||||
|
|
@ -807,15 +796,17 @@ def installStatusModSec(request):
|
|||
|
||||
def fetchModSecSettings(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('fetchStatus', 0)
|
||||
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'fetchStatus': 0, 'installed': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
modsecurity = 0
|
||||
SecAuditEngine = 0
|
||||
|
|
@ -906,16 +897,16 @@ def fetchModSecSettings(request):
|
|||
|
||||
def saveModSecConfigurations(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('saveStatus', 0)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'saveStatus': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
data = json.loads(request.body)
|
||||
|
||||
modsecurity = data['modsecurity_status']
|
||||
|
|
@ -996,11 +987,14 @@ def saveModSecConfigurations(request):
|
|||
|
||||
def modSecRules(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough privileges to access this page.")
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
confPath = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
|
||||
|
||||
|
|
@ -1022,10 +1016,12 @@ def modSecRules(request):
|
|||
def fetchModSecRules(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough privileges to access this page.")
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('modSecInstalled', 0)
|
||||
|
||||
confPath = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
|
||||
|
||||
|
|
@ -1059,19 +1055,18 @@ def fetchModSecRules(request):
|
|||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def saveModSecRules(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('saveStatus', 0)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'saveStatus': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
data = json.loads(request.body)
|
||||
|
||||
newModSecRules = data['modSecRules']
|
||||
|
|
@ -1114,15 +1109,15 @@ def saveModSecRules(request):
|
|||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def modSecRulesPacks(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough privileges to access this page.")
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
confPath = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
|
||||
|
||||
|
|
@ -1144,12 +1139,12 @@ def modSecRulesPacks(request):
|
|||
def getOWASPAndComodoStatus(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if admin.type == 3:
|
||||
final_dic = {'modSecInstalled': 0}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('modSecInstalled', 0)
|
||||
|
||||
confPath = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
|
||||
|
||||
|
|
@ -1198,16 +1193,16 @@ def getOWASPAndComodoStatus(request):
|
|||
|
||||
def installModSecRulesPack(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('installStatus', 0)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'installStatus': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
data = json.loads(request.body)
|
||||
|
||||
packName = data['packName']
|
||||
|
|
@ -1242,17 +1237,17 @@ def installModSecRulesPack(request):
|
|||
|
||||
def getRulesFiles(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('fetchStatus', 0)
|
||||
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'fetchStatus': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
data = json.loads(request.body)
|
||||
packName = data['packName']
|
||||
|
||||
|
|
@ -1308,16 +1303,16 @@ def getRulesFiles(request):
|
|||
|
||||
def enableDisableRuleFile(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk = val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('saveStatus', 0)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'saveStatus': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
data = json.loads(request.body)
|
||||
|
||||
packName = data['packName']
|
||||
|
|
@ -1359,10 +1354,12 @@ def enableDisableRuleFile(request):
|
|||
def csf(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough priviliges to access this page.")
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
csfInstalled = 1
|
||||
|
||||
|
|
@ -1380,16 +1377,15 @@ def csf(request):
|
|||
|
||||
def installCSF(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('installStatus', 0)
|
||||
try:
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'installStatus': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
execPath = "sudo " + virtualHostUtilities.cyberPanel + "/plogical/csf.py"
|
||||
execPath = execPath + " installCSF"
|
||||
subprocess.Popen(shlex.split(execPath))
|
||||
|
|
@ -1411,16 +1407,11 @@ def installCSF(request):
|
|||
|
||||
def installStatusCSF(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'abort': 1, 'installed': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
installStatus = unicode(open(CSF.installLogPath, "r").read())
|
||||
|
||||
if installStatus.find("[200]")>-1:
|
||||
|
|
@ -1466,16 +1457,15 @@ def installStatusCSF(request):
|
|||
|
||||
def removeCSF(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('installStatus', 0)
|
||||
try:
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'installStatus': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
execPath = "sudo " + virtualHostUtilities.cyberPanel + "/plogical/csf.py"
|
||||
execPath = execPath + " removeCSF"
|
||||
subprocess.Popen(shlex.split(execPath))
|
||||
|
|
@ -1497,16 +1487,15 @@ def removeCSF(request):
|
|||
|
||||
def fetchCSFSettings(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('fetchStatus', 0)
|
||||
try:
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'fetchStatus': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
currentSettings = CSF.fetchCSFSettings()
|
||||
|
||||
|
||||
|
|
@ -1529,17 +1518,16 @@ def fetchCSFSettings(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def changeStatus(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'status': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
try:
|
||||
|
||||
data = json.loads(request.body)
|
||||
|
||||
|
|
@ -1564,22 +1552,21 @@ def changeStatus(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
except KeyError:
|
||||
final_dic = {'status'
|
||||
'': 0, 'error_message': "Not Logged In, please refresh the page or login again."}
|
||||
final_dic = {'status': 0, 'error_message': "Not Logged In, please refresh the page or login again."}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
def modifyPorts(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
|
||||
try:
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'status': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
data = json.loads(request.body)
|
||||
|
||||
protocol = data['protocol']
|
||||
|
|
@ -1603,21 +1590,20 @@ def modifyPorts(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
except KeyError:
|
||||
final_dic = {'status'
|
||||
'': 0, 'error_message': "Not Logged In, please refresh the page or login again."}
|
||||
final_dic = {'status': 0, 'error_message': "Not Logged In, please refresh the page or login again."}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
def modifyIPs(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'status': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
try:
|
||||
|
||||
data = json.loads(request.body)
|
||||
|
||||
|
|
@ -1639,8 +1625,6 @@ def modifyIPs(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
except KeyError:
|
||||
final_dic = {'status'
|
||||
'': 0, 'error_message': "Not Logged In, please refresh the page or login again."}
|
||||
final_dic = {'status': 0, 'error_message': "Not Logged In, please refresh the page or login again."}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
|
|
|||
219
ftp/views.py
219
ftp/views.py
|
|
@ -14,6 +14,7 @@ from plogical.virtualHostUtilities import virtualHostUtilities
|
|||
import shlex
|
||||
from plogical.ftpUtilities import FTPUtilities
|
||||
import os
|
||||
from plogical.acl import ACLManager
|
||||
# Create your views here.
|
||||
|
||||
def loadFTPHome(request):
|
||||
|
|
@ -23,41 +24,26 @@ def loadFTPHome(request):
|
|||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def createFTPAccount(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['createFTPAccount'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
|
||||
try:
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
if not os.path.exists('/home/cyberpanel/pureftpd'):
|
||||
return render(request, "ftp/createFTPAccount.html", {"status": 0})
|
||||
|
||||
if admin.type == 1:
|
||||
websites = Websites.objects.all()
|
||||
websitesName = []
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
else:
|
||||
if admin.type == 2:
|
||||
websites = Websites.objects.filter(admin=admin)
|
||||
admins = Administrator.objects.filter(owner=admin.pk)
|
||||
websitesName = []
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
|
||||
for items in admins:
|
||||
webs = Websites.objects.filter(admin=items)
|
||||
|
||||
for web in webs:
|
||||
websitesName.append(web.domain)
|
||||
else:
|
||||
websitesName = []
|
||||
websites = Websites.objects.filter(admin=admin)
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||
|
||||
return render(request, 'ftp/createFTPAccount.html', {'websiteList':websitesName,'admin':admin.userName, "status": 1})
|
||||
except BaseException, msg:
|
||||
|
|
@ -67,13 +53,21 @@ def createFTPAccount(request):
|
|||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def submitFTPCreation(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['createFTPAccount'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('creatFTPStatus', 0)
|
||||
|
||||
|
||||
data = json.loads(request.body)
|
||||
userName = data['ftpUserName']
|
||||
|
|
@ -81,14 +75,7 @@ def submitFTPCreation(request):
|
|||
path = data['path']
|
||||
domainName = data['ftpDomain']
|
||||
|
||||
admin = Administrator.objects.get(id=val)
|
||||
website = Websites.objects.get(domain=domainName)
|
||||
|
||||
if admin.type != 1:
|
||||
if website.admin != admin:
|
||||
data_ret = {'creatFTPStatus': 0, 'error_message': 'Not enough privileges.'}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
admin = Administrator.objects.get(id=userID)
|
||||
|
||||
if len(path) > 0:
|
||||
pass
|
||||
|
|
@ -112,8 +99,6 @@ def submitFTPCreation(request):
|
|||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
|
||||
except BaseException,msg:
|
||||
data_ret = {'creatFTPStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
|
|
@ -123,41 +108,23 @@ def submitFTPCreation(request):
|
|||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def deleteFTPAccount(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['deleteFTPAccount'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
try:
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if not os.path.exists('/home/cyberpanel/pureftpd'):
|
||||
return render(request, "ftp/deleteFTPAccount.html", {"status": 0})
|
||||
|
||||
if admin.type == 1:
|
||||
websites = Websites.objects.all()
|
||||
websitesName = []
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
else:
|
||||
if admin.type == 2:
|
||||
websites = admin.websites_set.all()
|
||||
admins = Administrator.objects.filter(owner=admin.pk)
|
||||
websitesName = []
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
|
||||
for items in admins:
|
||||
webs = items.websites_set.all()
|
||||
|
||||
for web in webs:
|
||||
websitesName.append(web.domain)
|
||||
else:
|
||||
websitesName = []
|
||||
websites = Websites.objects.filter(admin=admin)
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||
|
||||
return render(request, 'ftp/deleteFTPAccount.html', {'websiteList':websitesName, "status": 1})
|
||||
except BaseException, msg:
|
||||
|
|
@ -167,25 +134,23 @@ def deleteFTPAccount(request):
|
|||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def fetchFTPAccounts(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['deleteFTPAccount'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('fetchStatus', 0)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
data = json.loads(request.body)
|
||||
domain = data['ftpDomain']
|
||||
|
||||
website = Websites.objects.get(domain=domain)
|
||||
admin = Administrator.objects.get(id=val)
|
||||
|
||||
if admin.type != 1:
|
||||
if website.admin != admin:
|
||||
data_ret = {'fetchStatus': 0, 'error_message': 'Not enough privileges.'}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
ftpAccounts = website.users_set.all()
|
||||
|
||||
|
|
@ -216,25 +181,24 @@ def fetchFTPAccounts(request):
|
|||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def submitFTPDelete(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(id=val)
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['deleteFTPAccount'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('deleteStatus', 0)
|
||||
|
||||
data = json.loads(request.body)
|
||||
ftpUserName = data['ftpUsername']
|
||||
|
||||
ftp = Users.objects.get(user=ftpUserName)
|
||||
|
||||
if admin.type != 1:
|
||||
if ftp.domain.admin != admin:
|
||||
data_ret = {'deleteStatus': 0, 'error_message': 'Not enough privileges.'}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
FTPUtilities.submitFTPDeletion(ftpUserName)
|
||||
|
||||
final_json = json.dumps({'deleteStatus': 1, 'error_message': "None"})
|
||||
|
|
@ -249,41 +213,23 @@ def submitFTPDelete(request):
|
|||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def listFTPAccounts(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['listFTPAccounts'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
try:
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if not os.path.exists('/home/cyberpanel/pureftpd'):
|
||||
return render(request, "ftp/listFTPAccounts.html", {"status": 0})
|
||||
|
||||
if admin.type == 1:
|
||||
websites = Websites.objects.all()
|
||||
websitesName = []
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
else:
|
||||
if admin.type == 2:
|
||||
websites = admin.websites_set.all()
|
||||
admins = Administrator.objects.filter(owner=admin.pk)
|
||||
websitesName = []
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
|
||||
for items in admins:
|
||||
webs = items.websites_set.all()
|
||||
|
||||
for web in webs:
|
||||
websitesName.append(web.domain)
|
||||
else:
|
||||
websitesName = []
|
||||
websites = Websites.objects.filter(admin=admin)
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||
|
||||
return render(request, 'ftp/listFTPAccounts.html', {'websiteList':websitesName, "status": 1})
|
||||
except BaseException, msg:
|
||||
|
|
@ -293,10 +239,17 @@ def listFTPAccounts(request):
|
|||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def getAllFTPAccounts(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['listFTPAccounts'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('fetchStatus', 0)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
|
|
@ -305,13 +258,6 @@ def getAllFTPAccounts(request):
|
|||
selectedDomain = data['selectedDomain']
|
||||
|
||||
domain = Websites.objects.get(domain=selectedDomain)
|
||||
admin = Administrator.objects.get(id=val)
|
||||
|
||||
if admin.type != 1:
|
||||
if domain.admin != admin:
|
||||
data_ret = {'fetchStatus': 0, 'error_message': 'Not enough privileges.'}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
records = Users.objects.filter(domain=domain)
|
||||
|
||||
|
|
@ -346,11 +292,16 @@ def getAllFTPAccounts(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def changePassword(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(id=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['listFTPAccounts'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('changePasswordStatus', 0)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
|
|
@ -358,14 +309,6 @@ def changePassword(request):
|
|||
userName = data['ftpUserName']
|
||||
password = data['ftpPassword']
|
||||
|
||||
ftp = Users.objects.get(user=userName)
|
||||
|
||||
if admin.type != 1:
|
||||
if ftp.domain.admin != admin:
|
||||
data_ret = {'changePasswordStatus': 0, 'error_message': 'Not enough privileges.'}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
FTPUtilities.changeFTPPassword(userName, password)
|
||||
|
||||
data_ret = {'changePasswordStatus': 1, 'error_message': "None"}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -5,6 +5,73 @@ from django.db import models
|
|||
|
||||
# Create your models here.
|
||||
|
||||
class ACL(models.Model):
|
||||
name = models.CharField(unique=True,max_length = 50)
|
||||
adminStatus = models.IntegerField(default=0)
|
||||
|
||||
## Version Management
|
||||
versionManagement = models.IntegerField(default=0)
|
||||
|
||||
## User Management
|
||||
createNewUser = models.IntegerField(default=0)
|
||||
deleteUser = models.IntegerField(default=0)
|
||||
resellerCenter = models.IntegerField(default=0)
|
||||
changeUserACL = models.IntegerField(default=0)
|
||||
|
||||
## Website Management
|
||||
|
||||
createWebsite = models.IntegerField(default=0)
|
||||
modifyWebsite = models.IntegerField(default=0)
|
||||
suspendWebsite = models.IntegerField(default=0)
|
||||
deleteWebsite = models.IntegerField(default=0)
|
||||
|
||||
## Package Management
|
||||
|
||||
createPackage = models.IntegerField(default=0)
|
||||
deletePackage = models.IntegerField(default=0)
|
||||
modifyPackage = models.IntegerField(default=0)
|
||||
|
||||
## Database Management
|
||||
|
||||
createDatabase = models.IntegerField(default=1)
|
||||
deleteDatabase = models.IntegerField(default=1)
|
||||
listDatabases = models.IntegerField(default=1)
|
||||
|
||||
## DNS Management
|
||||
|
||||
createNameServer = models.IntegerField(default=0)
|
||||
createDNSZone = models.IntegerField(default=1)
|
||||
deleteZone = models.IntegerField(default=1)
|
||||
addDeleteRecords = models.IntegerField(default=1)
|
||||
|
||||
## Email Management
|
||||
|
||||
createEmail = models.IntegerField(default=1)
|
||||
deleteEmail = models.IntegerField(default=1)
|
||||
emailForwarding = models.IntegerField(default=1)
|
||||
changeEmailPassword = models.IntegerField(default=1)
|
||||
dkimManager = models.IntegerField(default=1)
|
||||
|
||||
## FTP Management
|
||||
|
||||
createFTPAccount = models.IntegerField(default=1)
|
||||
deleteFTPAccount = models.IntegerField(default=1)
|
||||
listFTPAccounts = models.IntegerField(default=1)
|
||||
|
||||
## Backup Management
|
||||
|
||||
createBackup = models.IntegerField(default=1)
|
||||
restoreBackup = models.IntegerField(default=0)
|
||||
addDeleteDestinations = models.IntegerField(default=0)
|
||||
scheDuleBackups = models.IntegerField(default=0)
|
||||
remoteBackups = models.IntegerField(default=0)
|
||||
|
||||
## SSL Management
|
||||
|
||||
manageSSL = models.IntegerField(default=1)
|
||||
hostnameSSL = models.IntegerField(default=0)
|
||||
mailServerSSL = models.IntegerField(default=0)
|
||||
|
||||
class Administrator(models.Model):
|
||||
userName = models.CharField(unique=True,max_length = 50)
|
||||
password = models.CharField(max_length = 200)
|
||||
|
|
@ -14,5 +81,14 @@ class Administrator(models.Model):
|
|||
type = models.IntegerField()
|
||||
owner = models.IntegerField(default=1)
|
||||
|
||||
initUserAccountsLimit = models.IntegerField(default=0)
|
||||
initWebsitesLimit = models.IntegerField(default=0)
|
||||
initWebsitesLimit = models.IntegerField(default=0)
|
||||
acl = models.ForeignKey(ACL, default=1)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -67,13 +67,13 @@
|
|||
<div class="col-md-8 col-lg-6 clearfix center-margin">
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<h3 class="text-transform-upr font-size-17">CyberPanel <span class="opacity-80">v 1.7</span></h3>
|
||||
<h3 class="text-transform-upr font-size-17">CyberPanel Ent<span class="opacity-80">v 1.7</span></h3>
|
||||
<p class="font-gray">Web Hosting Control Panel</p>
|
||||
<div class="divider"></div>
|
||||
<ul class="reset-ul">
|
||||
<li class="pad10A font-size-16">
|
||||
<i class="glyph-icon icon-camera mrg10R font-green"></i>
|
||||
OpenLiteSpeed
|
||||
LiteSpeed
|
||||
</li>
|
||||
<li class="pad10A font-size-16">
|
||||
<i class="glyph-icon icon-cog mrg10R font-red"></i>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,5 @@ import views
|
|||
urlpatterns = [
|
||||
url(r'^$', views.loadLoginPage, name='adminLogin'),
|
||||
url(r'^verifyLogin$', views.verifyLogin, name='verifyLogin'),
|
||||
url(r'^logout', views.logout, name='logout'),
|
||||
|
||||
url(r'^logout', views.logout, name='logout')
|
||||
]
|
||||
|
|
@ -12,6 +12,8 @@ from baseTemplate.models import version
|
|||
from plogical.getSystemInformation import SystemInformation
|
||||
from django.utils.translation import LANGUAGE_SESSION_KEY
|
||||
import CyberCP.settings as settings
|
||||
from models import ACL
|
||||
from plogical.acl import ACLManager
|
||||
# Create your views here.
|
||||
|
||||
def verifyLogin(request):
|
||||
|
|
@ -113,15 +115,19 @@ def verifyLogin(request):
|
|||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def loadLoginPage(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
cpuRamDisk = SystemInformation.cpuRamDisk()
|
||||
|
||||
finaData = {"type": admin.type, 'ramUsage': cpuRamDisk['ramUsage'], 'cpuUsage': cpuRamDisk['cpuUsage'],
|
||||
if currentACL['admin'] == 1:
|
||||
admin = 1
|
||||
else:
|
||||
admin = 0
|
||||
|
||||
finaData = {"admin": admin, 'ramUsage': cpuRamDisk['ramUsage'], 'cpuUsage': cpuRamDisk['cpuUsage'],
|
||||
'diskUsage': cpuRamDisk['diskUsage']}
|
||||
|
||||
return render(request, 'baseTemplate/homePage.html', finaData)
|
||||
|
|
@ -132,9 +138,14 @@ def loadLoginPage(request):
|
|||
password = hashPassword.hash_password('1234567')
|
||||
|
||||
if numberOfAdministrator == 0:
|
||||
|
||||
ACLManager.createDefaultACLs()
|
||||
|
||||
acl = ACL.objects.get(name='admin')
|
||||
|
||||
email = 'usman@cyberpersons.com'
|
||||
admin = Administrator(userName="admin", password=password, type=1,email=email,
|
||||
firstName="Cyber",lastName="Panel")
|
||||
firstName="Cyber",lastName="Panel", acl=acl)
|
||||
admin.save()
|
||||
|
||||
vers = version(currentVersion="1.7",build=0)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import thread
|
|||
from dns.models import Domains as dnsDomains
|
||||
from dns.models import Records as dnsRecords
|
||||
from mailServer.models import Forwardings
|
||||
from plogical.acl import ACLManager
|
||||
import os
|
||||
|
||||
def loadEmailHome(request):
|
||||
|
|
@ -27,26 +28,23 @@ def loadEmailHome(request):
|
|||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def createEmailAccount(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['createEmail'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
try:
|
||||
|
||||
if not os.path.exists('/home/cyberpanel/postfix'):
|
||||
return render(request, "mailServer/createEmailAccount.html", {"status": 0})
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if admin.type == 1:
|
||||
websites = Websites.objects.all()
|
||||
else:
|
||||
websites = Websites.objects.filter(admin=admin)
|
||||
|
||||
websitesName = []
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||
|
||||
return render(request, 'mailServer/createEmailAccount.html', {'websiteList':websitesName, "status": 1})
|
||||
except BaseException, msg:
|
||||
|
|
@ -56,12 +54,19 @@ def createEmailAccount(request):
|
|||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def submitEmailCreation(request):
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['createEmail'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('createEmailStatus', 0)
|
||||
|
||||
data = json.loads(request.body)
|
||||
domainName = data['domain']
|
||||
|
|
@ -97,26 +102,23 @@ def submitEmailCreation(request):
|
|||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def deleteEmailAccount(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['deleteEmail'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
try:
|
||||
|
||||
if not os.path.exists('/home/cyberpanel/postfix'):
|
||||
return render(request, "mailServer/deleteEmailAccount.html", {"status": 0})
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if admin.type == 1:
|
||||
websites = Websites.objects.all()
|
||||
else:
|
||||
websites = Websites.objects.filter(admin=admin)
|
||||
|
||||
websitesName = []
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||
|
||||
return render(request, 'mailServer/deleteEmailAccount.html', {'websiteList':websitesName, "status": 1})
|
||||
except BaseException, msg:
|
||||
|
|
@ -126,11 +128,17 @@ def deleteEmailAccount(request):
|
|||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def getEmailsForDomain(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['deleteEmail'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('fetchStatus', 0)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
|
|
@ -144,12 +152,6 @@ def getEmailsForDomain(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
if admin.type != 1:
|
||||
if domain.domainOwner.admin != admin:
|
||||
final_dic = {'fetchStatus': 0, 'error_message': "Not enough privileges." }
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
emails = domain.eusers_set.all()
|
||||
|
||||
if emails.count() == 0:
|
||||
|
|
@ -186,20 +188,20 @@ def getEmailsForDomain(request):
|
|||
|
||||
def submitEmailDeletion(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['deleteEmail'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('deleteEmailStatus', 0)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
data = json.loads(request.body)
|
||||
email = data['email']
|
||||
emailDB = EUsers.objects.get(email=email)
|
||||
|
||||
if admin.type != 1:
|
||||
if emailDB.emailOwner.domainOwner.admin != admin:
|
||||
final_dic = {'deleteEmailStatus': 0, 'error_message': "Not enough privileges."}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
mailUtilities.deleteEmailAccount(email)
|
||||
data_ret = {'deleteEmailStatus': 1, 'error_message': "None"}
|
||||
|
|
@ -217,23 +219,21 @@ def submitEmailDeletion(request):
|
|||
|
||||
def emailForwarding(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['emailForwarding'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
try:
|
||||
|
||||
if not os.path.exists('/home/cyberpanel/postfix'):
|
||||
return render(request, "mailServer/emailForwarding.html", {"status": 0})
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if admin.type == 1:
|
||||
websites = Websites.objects.all()
|
||||
else:
|
||||
websites = Websites.objects.filter(admin=admin)
|
||||
|
||||
websitesName = []
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||
|
||||
return render(request, 'mailServer/emailForwarding.html', {'websiteList':websitesName, "status": 1})
|
||||
except BaseException, msg:
|
||||
|
|
@ -245,22 +245,21 @@ def emailForwarding(request):
|
|||
|
||||
def fetchCurrentForwardings(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['emailForwarding'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('fetchStatus', 0)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
data = json.loads(request.body)
|
||||
emailAddress = data['emailAddress']
|
||||
|
||||
emailDB = EUsers.objects.get(email=emailAddress)
|
||||
|
||||
if admin.type != 1:
|
||||
if emailDB.emailOwner.domainOwner.admin != admin:
|
||||
final_dic = {'fetchStatus': 1, 'error_message': "Not enough privileges."}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
currentForwardings = Forwardings.objects.filter(source=emailAddress)
|
||||
|
||||
json_data = "["
|
||||
|
|
@ -298,7 +297,15 @@ def fetchCurrentForwardings(request):
|
|||
|
||||
def submitForwardDeletion(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['emailForwarding'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('deleteForwardingStatus', 0)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
|
|
@ -323,24 +330,22 @@ def submitForwardDeletion(request):
|
|||
|
||||
def submitEmailForwardingCreation(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['emailForwarding'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('createStatus', 0)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
data = json.loads(request.body)
|
||||
source = data['source']
|
||||
destination = data['destination']
|
||||
|
||||
email = EUsers.objects.get(email=source)
|
||||
|
||||
if admin.type != 1:
|
||||
if email.emailOwner.domainOwner.admin != admin:
|
||||
final_dic = {'createStatus': 0, 'error_message': "Not enough privileges." }
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
if Forwardings.objects.filter(source=source, destination=destination).count() > 0:
|
||||
data_ret = {'createStatus': 0, 'error_message': "You have already forwared to this destination."}
|
||||
json_data = json.dumps(data_ret)
|
||||
|
|
@ -368,29 +373,25 @@ def submitEmailForwardingCreation(request):
|
|||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
#######
|
||||
|
||||
|
||||
def changeEmailAccountPassword(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['changeEmailPassword'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
try:
|
||||
|
||||
if not os.path.exists('/home/cyberpanel/postfix'):
|
||||
return render(request, "mailServer/changeEmailPassword.html", {"status": 0})
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if admin.type == 1:
|
||||
websites = Websites.objects.all()
|
||||
else:
|
||||
websites = Websites.objects.filter(admin=admin)
|
||||
|
||||
websitesName = []
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||
|
||||
return render(request, 'mailServer/changeEmailPassword.html', {'websiteList':websitesName, "status": 1})
|
||||
except BaseException, msg:
|
||||
|
|
@ -400,27 +401,25 @@ def changeEmailAccountPassword(request):
|
|||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def submitPasswordChange(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['changeEmailPassword'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('passChangeStatus', 0)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
data = json.loads(request.body)
|
||||
|
||||
domain = data['domain']
|
||||
email = data['email']
|
||||
password = data['password']
|
||||
|
||||
emailDB = EUsers.objects.get(email=email)
|
||||
|
||||
if admin.type != 1:
|
||||
if emailDB.emailOwner.domainOwner.admin != admin:
|
||||
final_dic = {'passChangeStatus': 0, 'error_message': "Not enough privileges." }
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
emailDB.delete()
|
||||
|
||||
dom = Domains(domain=domain)
|
||||
|
|
@ -446,42 +445,22 @@ def submitPasswordChange(request):
|
|||
|
||||
def dkimManager(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['dkimManager'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
openDKIMInstalled = 0
|
||||
|
||||
if mailUtilities.checkIfDKIMInstalled() == 1:
|
||||
openDKIMInstalled = 1
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if admin.type == 1:
|
||||
websites = Websites.objects.all()
|
||||
websitesName = []
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
else:
|
||||
if admin.type == 2:
|
||||
websites = admin.websites_set.all()
|
||||
admins = Administrator.objects.filter(owner=admin.pk)
|
||||
websitesName = []
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
|
||||
for items in admins:
|
||||
webs = items.websites_set.all()
|
||||
|
||||
for web in webs:
|
||||
websitesName.append(web.domain)
|
||||
|
||||
|
||||
else:
|
||||
websitesName = []
|
||||
websites = Websites.objects.filter(admin=admin)
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||
|
||||
return render(request, 'mailServer/dkimManager.html',
|
||||
{'websiteList': websitesName, 'openDKIMInstalled': openDKIMInstalled})
|
||||
|
|
@ -494,25 +473,22 @@ def dkimManager(request):
|
|||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def fetchDKIMKeys(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['dkimManager'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('fetchStatus', 0)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
data = json.loads(request.body)
|
||||
|
||||
domainName = data['domainName']
|
||||
|
||||
if admin.type != 1:
|
||||
website = Websites.objects.get(domain=domainName)
|
||||
if website.admin != admin:
|
||||
data_ret = {'fetchStatus': 0, 'keysAvailable': 0, 'error_message': 'Not enough privileges.'}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
try:
|
||||
path = "/etc/opendkim/keys/" + domainName + "/default.txt"
|
||||
command = "sudo cat " + path
|
||||
|
|
@ -544,21 +520,21 @@ def fetchDKIMKeys(request):
|
|||
|
||||
def generateDKIMKeys(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['dkimManager'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('generateStatus', 0)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
data = json.loads(request.body)
|
||||
domainName = data['domainName']
|
||||
|
||||
if admin.type != 1:
|
||||
website = Websites.objects.get(domain=domainName)
|
||||
if website.admin != admin:
|
||||
data_ret = {'generateStatus': 0, 'error_message': 'Not enough privileges.'}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/mailUtilities.py"
|
||||
execPath = execPath + " generateKeys --domain " + domainName
|
||||
output = subprocess.check_output(shlex.split(execPath))
|
||||
|
|
@ -603,13 +579,17 @@ def generateDKIMKeys(request):
|
|||
|
||||
def installOpenDKIM(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
try:
|
||||
if admin.type != 1:
|
||||
final_json = json.dumps({'installOpenDKIM': 0, 'error_message': "Not enough privileges."})
|
||||
return HttpResponse(final_json)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['dkimManager'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('installOpenDKIM', 0)
|
||||
|
||||
try:
|
||||
thread.start_new_thread(mailUtilities.installOpenDKIM, ('Install','openDKIM'))
|
||||
final_json = json.dumps({'installOpenDKIM': 1, 'error_message': "None"})
|
||||
return HttpResponse(final_json)
|
||||
|
|
@ -625,15 +605,9 @@ def installOpenDKIM(request):
|
|||
def installStatusOpenDKIM(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
final_dic = {'abort': 1, 'installed': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
command = "sudo cat " + mailUtilities.installLogPath
|
||||
installStatus = subprocess.check_output(shlex.split(command))
|
||||
|
||||
|
|
@ -672,7 +646,6 @@ def installStatusOpenDKIM(request):
|
|||
'requestStatus': installStatus,
|
||||
})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
else:
|
||||
final_json = json.dumps({
|
||||
'abort':0,
|
||||
|
|
@ -680,8 +653,6 @@ def installStatusOpenDKIM(request):
|
|||
'requestStatus': installStatus,
|
||||
})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
except BaseException,msg:
|
||||
final_dic = {'abort':1,'installed':0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
|
|
|
|||
|
|
@ -17,35 +17,35 @@ from loginSystem.models import Administrator
|
|||
from plogical.virtualHostUtilities import virtualHostUtilities
|
||||
import subprocess
|
||||
import shlex
|
||||
import plogical.CyberCPLogFileWriter as logging
|
||||
from random import randint
|
||||
from xml.etree import ElementTree
|
||||
from plogical.acl import ACLManager
|
||||
# Create your views here.
|
||||
|
||||
|
||||
def loadPHPHome(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough priviliges to access this page.")
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
return render(request,'managePHP/index.html')
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
|
||||
def installExtensions(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough priviliges to access this page.")
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
if PHP.objects.count() == 0:
|
||||
for i in range(3, 7):
|
||||
|
|
@ -1757,66 +1757,66 @@ def installExtensions(request):
|
|||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def getExtensionsInformation(request):
|
||||
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('fetchStatus', 0)
|
||||
|
||||
try:
|
||||
if admin.type == 1:
|
||||
if request.method == 'POST':
|
||||
if request.method == 'POST':
|
||||
|
||||
data = json.loads(request.body)
|
||||
phpVers = data['phpSelection']
|
||||
data = json.loads(request.body)
|
||||
phpVers = data['phpSelection']
|
||||
|
||||
if phpVers == "PHP 5.3":
|
||||
phpVers = "php53"
|
||||
elif phpVers == "PHP 5.4":
|
||||
phpVers = "php54"
|
||||
elif phpVers == "PHP 5.5":
|
||||
phpVers = "php55"
|
||||
elif phpVers == "PHP 5.6":
|
||||
phpVers = "php56"
|
||||
elif phpVers == "PHP 7.0":
|
||||
phpVers = "php70"
|
||||
elif phpVers == "PHP 7.1":
|
||||
phpVers = "php71"
|
||||
elif phpVers == "PHP 7.2":
|
||||
phpVers = "php72"
|
||||
if phpVers == "PHP 5.3":
|
||||
phpVers = "php53"
|
||||
elif phpVers == "PHP 5.4":
|
||||
phpVers = "php54"
|
||||
elif phpVers == "PHP 5.5":
|
||||
phpVers = "php55"
|
||||
elif phpVers == "PHP 5.6":
|
||||
phpVers = "php56"
|
||||
elif phpVers == "PHP 7.0":
|
||||
phpVers = "php70"
|
||||
elif phpVers == "PHP 7.1":
|
||||
phpVers = "php71"
|
||||
elif phpVers == "PHP 7.2":
|
||||
phpVers = "php72"
|
||||
|
||||
php = PHP.objects.get(phpVers=phpVers)
|
||||
php = PHP.objects.get(phpVers=phpVers)
|
||||
|
||||
records = php.installedpackages_set.all()
|
||||
records = php.installedpackages_set.all()
|
||||
|
||||
json_data = "["
|
||||
checker = 0
|
||||
json_data = "["
|
||||
checker = 0
|
||||
|
||||
for items in records:
|
||||
for items in records:
|
||||
|
||||
if items.status == 0:
|
||||
status = "Not-Installed"
|
||||
else:
|
||||
status = "Installed"
|
||||
if items.status == 0:
|
||||
status = "Not-Installed"
|
||||
else:
|
||||
status = "Installed"
|
||||
|
||||
dic = {'id': items.id,
|
||||
'phpVers': items.phpVers.phpVers,
|
||||
'extensionName': items.extensionName,
|
||||
'description': items.description,
|
||||
'status': status
|
||||
}
|
||||
dic = {'id': items.id,
|
||||
'phpVers': items.phpVers.phpVers,
|
||||
'extensionName': items.extensionName,
|
||||
'description': items.description,
|
||||
'status': status
|
||||
}
|
||||
|
||||
if checker == 0:
|
||||
json_data = json_data + json.dumps(dic)
|
||||
checker = 1
|
||||
else:
|
||||
json_data = json_data + ',' + json.dumps(dic)
|
||||
if checker == 0:
|
||||
json_data = json_data + json.dumps(dic)
|
||||
checker = 1
|
||||
else:
|
||||
json_data = json_data + ',' + json.dumps(dic)
|
||||
|
||||
json_data = json_data + ']'
|
||||
final_json = json.dumps({'fetchStatus': 1, 'error_message': "None", "data": json_data})
|
||||
return HttpResponse(final_json)
|
||||
else:
|
||||
final_json = json.dumps({'fetchStatus': 0, 'error_message': "Not enough privileges."})
|
||||
json_data = json_data + ']'
|
||||
final_json = json.dumps({'fetchStatus': 1, 'error_message': "None", "data": json_data})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException,msg:
|
||||
|
|
@ -1829,31 +1829,29 @@ def getExtensionsInformation(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def submitExtensionRequest(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('extensionRequestStatus', 0)
|
||||
try:
|
||||
if admin.type == 1:
|
||||
if request.method == 'POST':
|
||||
if request.method == 'POST':
|
||||
|
||||
data = json.loads(request.body)
|
||||
extensionName = data['extensionName']
|
||||
type = data['type']
|
||||
data = json.loads(request.body)
|
||||
extensionName = data['extensionName']
|
||||
type = data['type']
|
||||
|
||||
if type == "install":
|
||||
phpUtilities.initiateInstall(extensionName)
|
||||
|
||||
else:
|
||||
phpUtilities.initiateRemoval(extensionName)
|
||||
|
||||
if type=="install":
|
||||
phpUtilities.initiateInstall(extensionName)
|
||||
|
||||
else:
|
||||
phpUtilities.initiateRemoval(extensionName)
|
||||
|
||||
final_json = json.dumps({'extensionRequestStatus': 1, 'error_message': "None"})
|
||||
return HttpResponse(final_json)
|
||||
else:
|
||||
final_json = json.dumps({'extensionRequestStatus': 0, 'error_message': "Not enough privileges."})
|
||||
final_json = json.dumps({'extensionRequestStatus': 1, 'error_message': "None"})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException,msg:
|
||||
|
|
@ -1866,101 +1864,98 @@ def submitExtensionRequest(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def getRequestStatus(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin= Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('extensionRequestStatus', 0)
|
||||
|
||||
try:
|
||||
if admin.type == 1:
|
||||
if request.method == 'POST':
|
||||
data = json.loads(request.body)
|
||||
size = data['size']
|
||||
extensionName = data['extensionName']
|
||||
if request.method == 'POST':
|
||||
data = json.loads(request.body)
|
||||
size = data['size']
|
||||
extensionName = data['extensionName']
|
||||
|
||||
requestStatus = unicode(open(phpUtilities.installLogPath, "r").read())
|
||||
requestStatusSize = len(requestStatus)
|
||||
|
||||
requestStatus = unicode(open(phpUtilities.installLogPath, "r").read())
|
||||
requestStatusSize = len(requestStatus)
|
||||
|
||||
if requestStatus.find("PHP Extension Installed")>-1:
|
||||
if subprocess.check_output(["yum", "list", "installed"]).find(extensionName) > -1:
|
||||
ext = installedPackages.objects.get(extensionName=extensionName)
|
||||
ext.status = 1
|
||||
ext.save()
|
||||
else:
|
||||
ext = installedPackages.objects.get(extensionName=extensionName)
|
||||
ext.status = 0
|
||||
ext.save()
|
||||
|
||||
|
||||
installUtilities.reStartLiteSpeed()
|
||||
final_json = json.dumps({'finished': 1, 'extensionRequestStatus': 1,
|
||||
'error_message': "None",
|
||||
'requestStatus': requestStatus,
|
||||
'size': requestStatusSize})
|
||||
return HttpResponse(final_json)
|
||||
elif requestStatus.find("Can not be installed") > -1:
|
||||
|
||||
if subprocess.check_output(["yum", "list", "installed"]).find(extensionName) > -1:
|
||||
ext = installedPackages.objects.get(extensionName=extensionName)
|
||||
ext.status = 1
|
||||
ext.save()
|
||||
else:
|
||||
ext = installedPackages.objects.get(extensionName=extensionName)
|
||||
ext.status = 0
|
||||
ext.save()
|
||||
|
||||
installUtilities.reStartLiteSpeed()
|
||||
final_json = json.dumps({'finished': 1, 'extensionRequestStatus': 1,
|
||||
'error_message': "None",
|
||||
'requestStatus': requestStatus,
|
||||
'size': requestStatusSize})
|
||||
return HttpResponse(final_json)
|
||||
elif requestStatus.find("Can not un-install Extension") > -1:
|
||||
|
||||
if subprocess.check_output(["yum", "list", "installed"]).find(extensionName) > -1:
|
||||
ext = installedPackages.objects.get(extensionName=extensionName)
|
||||
ext.status = 1
|
||||
ext.save()
|
||||
else:
|
||||
ext = installedPackages.objects.get(extensionName=extensionName)
|
||||
ext.status = 0
|
||||
ext.save()
|
||||
|
||||
installUtilities.reStartLiteSpeed()
|
||||
final_json = json.dumps({'finished': 1, 'extensionRequestStatus': 1,
|
||||
'error_message': "None",
|
||||
'requestStatus': requestStatus,
|
||||
'size': requestStatusSize})
|
||||
return HttpResponse(final_json)
|
||||
elif requestStatus.find("PHP Extension Removed") > -1:
|
||||
|
||||
if subprocess.check_output(["yum", "list", "installed"]).find(extensionName) > -1:
|
||||
ext = installedPackages.objects.get(extensionName=extensionName)
|
||||
ext.status = 1
|
||||
ext.save()
|
||||
else:
|
||||
ext = installedPackages.objects.get(extensionName=extensionName)
|
||||
ext.status = 0
|
||||
ext.save()
|
||||
|
||||
installUtilities.reStartLiteSpeed()
|
||||
final_json = json.dumps({'finished': 1, 'extensionRequestStatus': 1,
|
||||
'error_message': "None",
|
||||
'requestStatus': requestStatus,
|
||||
'size': requestStatusSize})
|
||||
return HttpResponse(final_json)
|
||||
if requestStatus.find("PHP Extension Installed") > -1:
|
||||
if subprocess.check_output(["yum", "list", "installed"]).find(extensionName) > -1:
|
||||
ext = installedPackages.objects.get(extensionName=extensionName)
|
||||
ext.status = 1
|
||||
ext.save()
|
||||
else:
|
||||
final_json = json.dumps({'finished': 0, 'extensionRequestStatus': 1,
|
||||
'error_message': "None",
|
||||
'requestStatus': requestStatus,
|
||||
'size': requestStatusSize})
|
||||
return HttpResponse(final_json)
|
||||
ext = installedPackages.objects.get(extensionName=extensionName)
|
||||
ext.status = 0
|
||||
ext.save()
|
||||
|
||||
else:
|
||||
final_json = json.dumps({'finished': 0, 'extensionRequestStatus': 0,
|
||||
'error_message': "Not enough privileges."})
|
||||
return HttpResponse(final_json)
|
||||
installUtilities.reStartLiteSpeed()
|
||||
final_json = json.dumps({'finished': 1, 'extensionRequestStatus': 1,
|
||||
'error_message': "None",
|
||||
'requestStatus': requestStatus,
|
||||
'size': requestStatusSize})
|
||||
return HttpResponse(final_json)
|
||||
elif requestStatus.find("Can not be installed") > -1:
|
||||
|
||||
if subprocess.check_output(["yum", "list", "installed"]).find(extensionName) > -1:
|
||||
ext = installedPackages.objects.get(extensionName=extensionName)
|
||||
ext.status = 1
|
||||
ext.save()
|
||||
else:
|
||||
ext = installedPackages.objects.get(extensionName=extensionName)
|
||||
ext.status = 0
|
||||
ext.save()
|
||||
|
||||
installUtilities.reStartLiteSpeed()
|
||||
final_json = json.dumps({'finished': 1, 'extensionRequestStatus': 1,
|
||||
'error_message': "None",
|
||||
'requestStatus': requestStatus,
|
||||
'size': requestStatusSize})
|
||||
return HttpResponse(final_json)
|
||||
elif requestStatus.find("Can not un-install Extension") > -1:
|
||||
|
||||
if subprocess.check_output(["yum", "list", "installed"]).find(extensionName) > -1:
|
||||
ext = installedPackages.objects.get(extensionName=extensionName)
|
||||
ext.status = 1
|
||||
ext.save()
|
||||
else:
|
||||
ext = installedPackages.objects.get(extensionName=extensionName)
|
||||
ext.status = 0
|
||||
ext.save()
|
||||
|
||||
installUtilities.reStartLiteSpeed()
|
||||
final_json = json.dumps({'finished': 1, 'extensionRequestStatus': 1,
|
||||
'error_message': "None",
|
||||
'requestStatus': requestStatus,
|
||||
'size': requestStatusSize})
|
||||
return HttpResponse(final_json)
|
||||
elif requestStatus.find("PHP Extension Removed") > -1:
|
||||
|
||||
if subprocess.check_output(["yum", "list", "installed"]).find(extensionName) > -1:
|
||||
ext = installedPackages.objects.get(extensionName=extensionName)
|
||||
ext.status = 1
|
||||
ext.save()
|
||||
else:
|
||||
ext = installedPackages.objects.get(extensionName=extensionName)
|
||||
ext.status = 0
|
||||
ext.save()
|
||||
|
||||
installUtilities.reStartLiteSpeed()
|
||||
final_json = json.dumps({'finished': 1, 'extensionRequestStatus': 1,
|
||||
'error_message': "None",
|
||||
'requestStatus': requestStatus,
|
||||
'size': requestStatusSize})
|
||||
return HttpResponse(final_json)
|
||||
else:
|
||||
final_json = json.dumps({'finished': 0, 'extensionRequestStatus': 1,
|
||||
'error_message': "None",
|
||||
'requestStatus': requestStatus,
|
||||
'size': requestStatusSize})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
|
||||
|
|
@ -1973,105 +1968,97 @@ def getRequestStatus(request):
|
|||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
|
||||
def editPHPConfigs(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough privileges to access this page.")
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
return render(request,'managePHP/editPHPConfig.html')
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def getCurrentPHPConfig(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('fetchStatus', 0)
|
||||
try:
|
||||
if admin.type == 1:
|
||||
if request.method == 'POST':
|
||||
if request.method == 'POST':
|
||||
|
||||
data = json.loads(request.body)
|
||||
phpVers = data['phpSelection']
|
||||
data = json.loads(request.body)
|
||||
phpVers = data['phpSelection']
|
||||
|
||||
if phpVers == "PHP 5.3":
|
||||
phpVers = "php53"
|
||||
elif phpVers == "PHP 5.4":
|
||||
phpVers = "php54"
|
||||
elif phpVers == "PHP 5.5":
|
||||
phpVers = "php55"
|
||||
elif phpVers == "PHP 5.6":
|
||||
phpVers = "php56"
|
||||
elif phpVers == "PHP 7.0":
|
||||
phpVers = "php70"
|
||||
elif phpVers == "PHP 7.1":
|
||||
phpVers = "php71"
|
||||
elif phpVers == "PHP 7.2":
|
||||
phpVers = "php72"
|
||||
if phpVers == "PHP 5.3":
|
||||
phpVers = "php53"
|
||||
elif phpVers == "PHP 5.4":
|
||||
phpVers = "php54"
|
||||
elif phpVers == "PHP 5.5":
|
||||
phpVers = "php55"
|
||||
elif phpVers == "PHP 5.6":
|
||||
phpVers = "php56"
|
||||
elif phpVers == "PHP 7.0":
|
||||
phpVers = "php70"
|
||||
elif phpVers == "PHP 7.1":
|
||||
phpVers = "php71"
|
||||
elif phpVers == "PHP 7.2":
|
||||
phpVers = "php72"
|
||||
|
||||
path = "/usr/local/lsws/ls"+phpVers+"/etc/php.ini"
|
||||
path = "/usr/local/lsws/ls" + phpVers + "/etc/php.ini"
|
||||
|
||||
allow_url_fopen = "0"
|
||||
display_errors = "0"
|
||||
file_uploads = "0"
|
||||
allow_url_include = "0"
|
||||
memory_limit = ""
|
||||
max_execution_time = ""
|
||||
upload_max_filesize = ""
|
||||
max_input_time = ""
|
||||
allow_url_fopen = "0"
|
||||
display_errors = "0"
|
||||
file_uploads = "0"
|
||||
allow_url_include = "0"
|
||||
memory_limit = ""
|
||||
max_execution_time = ""
|
||||
upload_max_filesize = ""
|
||||
max_input_time = ""
|
||||
|
||||
data = open(path,'r').readlines()
|
||||
data = open(path, 'r').readlines()
|
||||
|
||||
for items in data:
|
||||
if items.find("allow_url_fopen")>-1 and items.find("=")>-1:
|
||||
if items.find("On") > -1:
|
||||
allow_url_fopen = "1"
|
||||
if items.find("display_errors")>-1 and items.find("=")>-1:
|
||||
if items.find("On") > -1:
|
||||
display_errors = "1"
|
||||
if items.find("file_uploads")>-1 and items.find("=")>-1:
|
||||
if items.find("On") > -1:
|
||||
file_uploads = "1"
|
||||
if items.find("allow_url_include")>-1 and items.find("=")>-1:
|
||||
if items.find("On") > -1:
|
||||
allow_url_include = "1"
|
||||
if items.find("memory_limit")>-1 and items.find("=")>-1:
|
||||
memory_limit = re.findall(r"[A-Za-z0-9_]+", items)[1]
|
||||
if items.find("max_execution_time")>-1 and items.find("=")>-1:
|
||||
max_execution_time = re.findall(r"[A-Za-z0-9_]+", items)[1]
|
||||
if items.find("upload_max_filesize")>-1 and items.find("=")>-1:
|
||||
upload_max_filesize = re.findall(r"[A-Za-z0-9_]+", items)[1]
|
||||
if items.find("max_input_time")>-1 and items.find("=")>-1:
|
||||
max_input_time = re.findall(r"[A-Za-z0-9_]+", items)[1]
|
||||
if items.find("post_max_size") > -1 and items.find("=") > -1:
|
||||
post_max_size = re.findall(r"[A-Za-z0-9_]+", items)[1]
|
||||
for items in data:
|
||||
if items.find("allow_url_fopen") > -1 and items.find("=") > -1:
|
||||
if items.find("On") > -1:
|
||||
allow_url_fopen = "1"
|
||||
if items.find("display_errors") > -1 and items.find("=") > -1:
|
||||
if items.find("On") > -1:
|
||||
display_errors = "1"
|
||||
if items.find("file_uploads") > -1 and items.find("=") > -1:
|
||||
if items.find("On") > -1:
|
||||
file_uploads = "1"
|
||||
if items.find("allow_url_include") > -1 and items.find("=") > -1:
|
||||
if items.find("On") > -1:
|
||||
allow_url_include = "1"
|
||||
if items.find("memory_limit") > -1 and items.find("=") > -1:
|
||||
memory_limit = re.findall(r"[A-Za-z0-9_]+", items)[1]
|
||||
if items.find("max_execution_time") > -1 and items.find("=") > -1:
|
||||
max_execution_time = re.findall(r"[A-Za-z0-9_]+", items)[1]
|
||||
if items.find("upload_max_filesize") > -1 and items.find("=") > -1:
|
||||
upload_max_filesize = re.findall(r"[A-Za-z0-9_]+", items)[1]
|
||||
if items.find("max_input_time") > -1 and items.find("=") > -1:
|
||||
max_input_time = re.findall(r"[A-Za-z0-9_]+", items)[1]
|
||||
if items.find("post_max_size") > -1 and items.find("=") > -1:
|
||||
post_max_size = re.findall(r"[A-Za-z0-9_]+", items)[1]
|
||||
|
||||
|
||||
|
||||
final_dic = {'fetchStatus': 1,
|
||||
'allow_url_fopen': allow_url_fopen,
|
||||
'display_errors': display_errors,
|
||||
'file_uploads': file_uploads,
|
||||
'allow_url_include': allow_url_include,
|
||||
'memory_limit': memory_limit,
|
||||
'max_execution_time': max_execution_time,
|
||||
'upload_max_filesize': upload_max_filesize,
|
||||
'max_input_time': max_input_time,
|
||||
'post_max_size':post_max_size}
|
||||
|
||||
final_json = json.dumps(final_dic)
|
||||
|
||||
return HttpResponse(final_json)
|
||||
else:
|
||||
final_dic = {'fetchStatus': 0,
|
||||
'error_message': 'Not enough privileges.'
|
||||
}
|
||||
final_dic = {'fetchStatus': 1,
|
||||
'allow_url_fopen': allow_url_fopen,
|
||||
'display_errors': display_errors,
|
||||
'file_uploads': file_uploads,
|
||||
'allow_url_include': allow_url_include,
|
||||
'memory_limit': memory_limit,
|
||||
'max_execution_time': max_execution_time,
|
||||
'upload_max_filesize': upload_max_filesize,
|
||||
'max_input_time': max_input_time,
|
||||
'post_max_size': post_max_size}
|
||||
|
||||
final_json = json.dumps(final_dic)
|
||||
|
||||
|
|
@ -2088,87 +2075,81 @@ def getCurrentPHPConfig(request):
|
|||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def savePHPConfigBasic(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(id=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('saveStatus', 0)
|
||||
try:
|
||||
if admin.type == 1:
|
||||
if request.method == 'POST':
|
||||
if request.method == 'POST':
|
||||
|
||||
data = json.loads(request.body)
|
||||
phpVers = data['phpSelection']
|
||||
allow_url_fopen = data['allow_url_fopen']
|
||||
display_errors = data['display_errors']
|
||||
file_uploads = data['file_uploads']
|
||||
allow_url_include = data['allow_url_include']
|
||||
memory_limit = data['memory_limit']
|
||||
max_execution_time = data['max_execution_time']
|
||||
upload_max_filesize = data['upload_max_filesize']
|
||||
max_input_time = data['max_input_time']
|
||||
post_max_size = data['post_max_size']
|
||||
data = json.loads(request.body)
|
||||
phpVers = data['phpSelection']
|
||||
allow_url_fopen = data['allow_url_fopen']
|
||||
display_errors = data['display_errors']
|
||||
file_uploads = data['file_uploads']
|
||||
allow_url_include = data['allow_url_include']
|
||||
memory_limit = data['memory_limit']
|
||||
max_execution_time = data['max_execution_time']
|
||||
upload_max_filesize = data['upload_max_filesize']
|
||||
max_input_time = data['max_input_time']
|
||||
post_max_size = data['post_max_size']
|
||||
|
||||
if allow_url_fopen == True:
|
||||
allow_url_fopen = "allow_url_fopen = On"
|
||||
else:
|
||||
allow_url_fopen = "allow_url_fopen = Off"
|
||||
if allow_url_fopen == True:
|
||||
allow_url_fopen = "allow_url_fopen = On"
|
||||
else:
|
||||
allow_url_fopen = "allow_url_fopen = Off"
|
||||
|
||||
if display_errors == True:
|
||||
display_errors = "display_errors = On"
|
||||
else:
|
||||
display_errors = "display_errors = Off"
|
||||
if display_errors == True:
|
||||
display_errors = "display_errors = On"
|
||||
else:
|
||||
display_errors = "display_errors = Off"
|
||||
|
||||
if file_uploads == True:
|
||||
file_uploads = "file_uploads = On"
|
||||
else:
|
||||
file_uploads = "file_uploads = Off"
|
||||
|
||||
if file_uploads == True:
|
||||
file_uploads = "file_uploads = On"
|
||||
else:
|
||||
file_uploads = "file_uploads = Off"
|
||||
if allow_url_include == True:
|
||||
allow_url_include = "allow_url_include = On"
|
||||
else:
|
||||
allow_url_include = "allow_url_include = Off"
|
||||
|
||||
if phpVers == "PHP 5.3":
|
||||
phpVers = "php53"
|
||||
elif phpVers == "PHP 5.4":
|
||||
phpVers = "php54"
|
||||
elif phpVers == "PHP 5.5":
|
||||
phpVers = "php55"
|
||||
elif phpVers == "PHP 5.6":
|
||||
phpVers = "php56"
|
||||
elif phpVers == "PHP 7.0":
|
||||
phpVers = "php70"
|
||||
elif phpVers == "PHP 7.1":
|
||||
phpVers = "php71"
|
||||
elif phpVers == "PHP 7.2":
|
||||
phpVers = "php72"
|
||||
|
||||
if allow_url_include == True:
|
||||
allow_url_include = "allow_url_include = On"
|
||||
else:
|
||||
allow_url_include = "allow_url_include = Off"
|
||||
##
|
||||
|
||||
if phpVers == "PHP 5.3":
|
||||
phpVers = "php53"
|
||||
elif phpVers == "PHP 5.4":
|
||||
phpVers = "php54"
|
||||
elif phpVers == "PHP 5.5":
|
||||
phpVers = "php55"
|
||||
elif phpVers == "PHP 5.6":
|
||||
phpVers = "php56"
|
||||
elif phpVers == "PHP 7.0":
|
||||
phpVers = "php70"
|
||||
elif phpVers == "PHP 7.1":
|
||||
phpVers = "php71"
|
||||
elif phpVers == "PHP 7.2":
|
||||
phpVers = "php72"
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/phpUtilities.py"
|
||||
|
||||
##
|
||||
execPath = execPath + " savePHPConfigBasic --phpVers " + phpVers + " --allow_url_fopen '" + allow_url_fopen + "' --display_errors '" + display_errors + "' --file_uploads '" + file_uploads + "' --allow_url_include '" + allow_url_include + "' --memory_limit " + memory_limit + " --max_execution_time " + max_execution_time + " --upload_max_filesize " + upload_max_filesize + " --max_input_time " + max_input_time + " --post_max_size " + post_max_size
|
||||
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/phpUtilities.py"
|
||||
output = subprocess.check_output(shlex.split(execPath))
|
||||
|
||||
execPath = execPath + " savePHPConfigBasic --phpVers " + phpVers + " --allow_url_fopen '" + allow_url_fopen + "' --display_errors '" + display_errors + "' --file_uploads '" + file_uploads + "' --allow_url_include '" + allow_url_include + "' --memory_limit " + memory_limit+ " --max_execution_time " + max_execution_time + " --upload_max_filesize " + upload_max_filesize + " --max_input_time " + max_input_time + " --post_max_size " + post_max_size
|
||||
|
||||
|
||||
|
||||
output = subprocess.check_output(shlex.split(execPath))
|
||||
|
||||
if output.find("1,None") > -1:
|
||||
data_ret = {'saveStatus': 1}
|
||||
final_json = json.dumps(data_ret)
|
||||
return HttpResponse(final_json)
|
||||
else:
|
||||
final_dic = {'saveStatus': 0, 'error_message': output}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
else:
|
||||
final_dic = {'saveStatus': 0, 'error_message': 'Not enough privileges.'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
if output.find("1,None") > -1:
|
||||
data_ret = {'saveStatus': 1}
|
||||
final_json = json.dumps(data_ret)
|
||||
return HttpResponse(final_json)
|
||||
else:
|
||||
final_dic = {'saveStatus': 0, 'error_message': output}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException,msg:
|
||||
final_dic = {'saveStatus': 0, 'error_message': str(msg)}
|
||||
|
|
@ -2177,48 +2158,43 @@ def savePHPConfigBasic(request):
|
|||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
|
||||
#### Get Advance PHP Configs
|
||||
|
||||
|
||||
|
||||
def getCurrentAdvancedPHPConfig(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(id=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('fetchStatus', 0)
|
||||
try:
|
||||
if admin.type == 1:
|
||||
if request.method == 'POST':
|
||||
if request.method == 'POST':
|
||||
|
||||
data = json.loads(request.body)
|
||||
phpVers = data['phpSelection']
|
||||
data = json.loads(request.body)
|
||||
phpVers = data['phpSelection']
|
||||
|
||||
if phpVers == "PHP 5.3":
|
||||
phpVers = "php53"
|
||||
elif phpVers == "PHP 5.4":
|
||||
phpVers = "php54"
|
||||
elif phpVers == "PHP 5.5":
|
||||
phpVers = "php55"
|
||||
elif phpVers == "PHP 5.6":
|
||||
phpVers = "php56"
|
||||
elif phpVers == "PHP 7.0":
|
||||
phpVers = "php70"
|
||||
elif phpVers == "PHP 7.1":
|
||||
phpVers = "php71"
|
||||
elif phpVers == "PHP 7.2":
|
||||
phpVers = "php72"
|
||||
if phpVers == "PHP 5.3":
|
||||
phpVers = "php53"
|
||||
elif phpVers == "PHP 5.4":
|
||||
phpVers = "php54"
|
||||
elif phpVers == "PHP 5.5":
|
||||
phpVers = "php55"
|
||||
elif phpVers == "PHP 5.6":
|
||||
phpVers = "php56"
|
||||
elif phpVers == "PHP 7.0":
|
||||
phpVers = "php70"
|
||||
elif phpVers == "PHP 7.1":
|
||||
phpVers = "php71"
|
||||
elif phpVers == "PHP 7.2":
|
||||
phpVers = "php72"
|
||||
|
||||
path = "/usr/local/lsws/ls"+phpVers+"/etc/php.ini"
|
||||
path = "/usr/local/lsws/ls" + phpVers + "/etc/php.ini"
|
||||
|
||||
configData = open(path, "r").read()
|
||||
configData = open(path, "r").read()
|
||||
|
||||
status = {"fetchStatus": 1, "configData": configData}
|
||||
final_json = json.dumps(status)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
else:
|
||||
status = {"fetchStatus": 1, "error_message": 'Not enough privileges.'}
|
||||
status = {"fetchStatus": 1, "configData": configData}
|
||||
final_json = json.dumps(status)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
|
@ -2230,69 +2206,65 @@ def getCurrentAdvancedPHPConfig(request):
|
|||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def savePHPConfigAdvance(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if admin.type == 1:
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('saveStatus', 0)
|
||||
|
||||
if request.method == 'POST':
|
||||
try:
|
||||
data = json.loads(request.body)
|
||||
phpVers = data['phpSelection']
|
||||
if request.method == 'POST':
|
||||
try:
|
||||
data = json.loads(request.body)
|
||||
phpVers = data['phpSelection']
|
||||
|
||||
if phpVers == "PHP 5.3":
|
||||
phpVers = "php53"
|
||||
elif phpVers == "PHP 5.4":
|
||||
phpVers = "php54"
|
||||
elif phpVers == "PHP 5.5":
|
||||
phpVers = "php55"
|
||||
elif phpVers == "PHP 5.6":
|
||||
phpVers = "php56"
|
||||
elif phpVers == "PHP 7.0":
|
||||
phpVers = "php70"
|
||||
elif phpVers == "PHP 7.1":
|
||||
phpVers = "php71"
|
||||
elif phpVers == "PHP 7.2":
|
||||
phpVers = "php72"
|
||||
if phpVers == "PHP 5.3":
|
||||
phpVers = "php53"
|
||||
elif phpVers == "PHP 5.4":
|
||||
phpVers = "php54"
|
||||
elif phpVers == "PHP 5.5":
|
||||
phpVers = "php55"
|
||||
elif phpVers == "PHP 5.6":
|
||||
phpVers = "php56"
|
||||
elif phpVers == "PHP 7.0":
|
||||
phpVers = "php70"
|
||||
elif phpVers == "PHP 7.1":
|
||||
phpVers = "php71"
|
||||
elif phpVers == "PHP 7.2":
|
||||
phpVers = "php72"
|
||||
|
||||
path = "/usr/local/lsws/ls" + phpVers + "/etc/php.ini"
|
||||
path = "/usr/local/lsws/ls" + phpVers + "/etc/php.ini"
|
||||
|
||||
tempPath = "/home/cyberpanel/" + str(randint(1000, 9999))
|
||||
tempPath = "/home/cyberpanel/" + str(randint(1000, 9999))
|
||||
|
||||
vhost = open(tempPath, "w")
|
||||
vhost = open(tempPath, "w")
|
||||
|
||||
vhost.write(data['configData'])
|
||||
vhost.write(data['configData'])
|
||||
|
||||
vhost.close()
|
||||
vhost.close()
|
||||
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/phpUtilities.py"
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/phpUtilities.py"
|
||||
|
||||
execPath = execPath + " savePHPConfigAdvance --phpVers " + path + " --tempPath " + tempPath
|
||||
execPath = execPath + " savePHPConfigAdvance --phpVers " + path + " --tempPath " + tempPath
|
||||
|
||||
output = subprocess.check_output(shlex.split(execPath))
|
||||
|
||||
|
||||
output = subprocess.check_output(shlex.split(execPath))
|
||||
|
||||
if output.find("1,None") > -1:
|
||||
status = {"saveStatus": 1, "configData": data['configData']}
|
||||
final_json = json.dumps(status)
|
||||
return HttpResponse(final_json)
|
||||
else:
|
||||
data_ret = {'saveStatus': 0, 'error_message': output}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
data_ret = {'saveStatus': 0, 'error_message': str(msg)}
|
||||
if output.find("1,None") > -1:
|
||||
status = {"saveStatus": 1, "configData": data['configData']}
|
||||
final_json = json.dumps(status)
|
||||
return HttpResponse(final_json)
|
||||
else:
|
||||
data_ret = {'saveStatus': 0, 'error_message': output}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
else:
|
||||
data_ret = {'saveStatus': 0, 'error_message': 'Not enough privileges.'}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
data_ret = {'saveStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except KeyError, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[saveConfigsToFile]")
|
||||
|
|
|
|||
|
|
@ -6,15 +6,11 @@ from loginSystem.views import loadLoginPage
|
|||
from websiteFunctions.models import Websites,ChildDomains
|
||||
from loginSystem.models import Administrator
|
||||
from plogical.virtualHostUtilities import virtualHostUtilities
|
||||
from plogical.sslUtilities import sslUtilities
|
||||
from plogical.installUtilities import installUtilities
|
||||
from django.http import HttpResponse
|
||||
import json
|
||||
import os
|
||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||
import shutil
|
||||
import shlex
|
||||
import subprocess
|
||||
from plogical.acl import ACLManager
|
||||
# Create your views here.
|
||||
|
||||
|
||||
|
|
@ -27,47 +23,36 @@ def loadSSLHome(request):
|
|||
|
||||
def manageSSL(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if admin.type == 1:
|
||||
websites = Websites.objects.all()
|
||||
websitesName = []
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['manageSSL'] == 1:
|
||||
pass
|
||||
else:
|
||||
if admin.type == 2:
|
||||
websites = admin.websites_set.all()
|
||||
admins = Administrator.objects.filter(owner=admin.pk)
|
||||
websitesName = []
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
|
||||
for items in admins:
|
||||
webs = items.websites_set.all()
|
||||
|
||||
for web in webs:
|
||||
websitesName.append(web.domain)
|
||||
else:
|
||||
websitesName = []
|
||||
websites = Websites.objects.filter(admin=admin)
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
return ACLManager.loadError()
|
||||
|
||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||
|
||||
return render(request, 'manageSSL/manageSSL.html',{'websiteList':websitesName})
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def issueSSL(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['manageSSL'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('SSL', 0)
|
||||
|
||||
data = json.loads(request.body)
|
||||
virtualHost = data['virtualHost']
|
||||
|
|
@ -75,32 +60,16 @@ def issueSSL(request):
|
|||
adminEmail = ""
|
||||
path = ""
|
||||
|
||||
|
||||
try:
|
||||
website = ChildDomains.objects.get(domain=virtualHost)
|
||||
adminEmail = website.master.adminEmail
|
||||
path = data['path']
|
||||
|
||||
if admin.type != 1:
|
||||
if admin != website.master.admin:
|
||||
data_ret = {"SSL": 0,
|
||||
'error_message': 'You do not own this domain.'}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except:
|
||||
website = Websites.objects.get(domain=virtualHost)
|
||||
adminEmail = website.adminEmail
|
||||
path = "/home/" + virtualHost + "/public_html"
|
||||
|
||||
if admin.type != 1:
|
||||
if admin != website.admin:
|
||||
data_ret = {"SSL": 0,
|
||||
'error_message': 'You do not own this website.'}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
## ssl issue
|
||||
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
||||
|
|
@ -139,43 +108,19 @@ def issueSSL(request):
|
|||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def sslForHostName(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if admin.type==1:
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['hostnameSSL'] == 1:
|
||||
pass
|
||||
else:
|
||||
return HttpResponse("You should be admin to issue SSL For Hostname.")
|
||||
return ACLManager.loadError()
|
||||
|
||||
if admin.type == 1:
|
||||
websites = Websites.objects.all()
|
||||
websitesName = []
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
else:
|
||||
if admin.type == 2:
|
||||
websites = admin.websites_set.all()
|
||||
admins = Administrator.objects.filter(owner=admin.pk)
|
||||
websitesName = []
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
|
||||
for items in admins:
|
||||
webs = items.websites_set.all()
|
||||
|
||||
for web in webs:
|
||||
websitesName.append(web.domain)
|
||||
else:
|
||||
websitesName = []
|
||||
websites = Websites.objects.filter(admin=admin)
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||
|
||||
return render(request, 'manageSSL/sslForHostName.html',{'websiteList':websitesName})
|
||||
except KeyError:
|
||||
|
|
@ -183,43 +128,44 @@ def sslForHostName(request):
|
|||
|
||||
def obtainHostNameSSL(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if admin.type == 1:
|
||||
if request.method == 'POST':
|
||||
if request.method == 'POST':
|
||||
|
||||
data = json.loads(request.body)
|
||||
virtualHost = data['virtualHost']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
path = "/home/" + virtualHost + "/public_html"
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['hostnameSSL'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('SSL', 0)
|
||||
|
||||
## ssl issue
|
||||
data = json.loads(request.body)
|
||||
virtualHost = data['virtualHost']
|
||||
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
||||
path = "/home/" + virtualHost + "/public_html"
|
||||
|
||||
execPath = execPath + " issueSSLForHostName --virtualHostName " + virtualHost + " --path " + path
|
||||
## ssl issue
|
||||
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
||||
|
||||
output = subprocess.check_output(shlex.split(execPath))
|
||||
execPath = execPath + " issueSSLForHostName --virtualHostName " + virtualHost + " --path " + path
|
||||
|
||||
if output.find("1,None") > -1:
|
||||
data_ret = {"SSL": 1,
|
||||
'error_message': "None"}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
else:
|
||||
data_ret = {"SSL": 0,
|
||||
'error_message': output}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
output = subprocess.check_output(shlex.split(execPath))
|
||||
|
||||
if output.find("1,None") > -1:
|
||||
data_ret = {"SSL": 1,
|
||||
'error_message': "None"}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
else:
|
||||
data_ret = {"SSL": 0,
|
||||
'error_message': output}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
## ssl issue ends
|
||||
else:
|
||||
data_ret = {"SSL": 0,
|
||||
'error_message': 'Only administrators can issue Hostname SSL.'}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException,msg:
|
||||
data_ret = {"SSL": 0,
|
||||
|
|
@ -234,40 +180,17 @@ def obtainHostNameSSL(request):
|
|||
|
||||
def sslForMailServer(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||
|
||||
if admin.type==1:
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['mailServerSSL'] == 1:
|
||||
pass
|
||||
else:
|
||||
return HttpResponse("You should be admin to issue SSL For Mail Server.")
|
||||
return ACLManager.loadError()
|
||||
|
||||
if admin.type == 1:
|
||||
websites = Websites.objects.all()
|
||||
websitesName = []
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
else:
|
||||
if admin.type == 2:
|
||||
websites = admin.websites_set.all()
|
||||
admins = Administrator.objects.filter(owner=admin.pk)
|
||||
websitesName = []
|
||||
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
|
||||
for items in admins:
|
||||
webs = items.websites_set.all()
|
||||
|
||||
for web in webs:
|
||||
websitesName.append(web.domain)
|
||||
else:
|
||||
websitesName = []
|
||||
websites = Websites.objects.filter(admin=admin)
|
||||
for items in websites:
|
||||
websitesName.append(items.domain)
|
||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||
|
||||
return render(request, 'manageSSL/sslForMailServer.html',{'websiteList':websitesName})
|
||||
except KeyError:
|
||||
|
|
@ -275,42 +198,44 @@ def sslForMailServer(request):
|
|||
|
||||
def obtainMailServerSSL(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if admin.type == 1:
|
||||
if request.method == 'POST':
|
||||
if request.method == 'POST':
|
||||
|
||||
data = json.loads(request.body)
|
||||
virtualHost = data['virtualHost']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
path = "/home/" + virtualHost + "/public_html"
|
||||
|
||||
## ssl issue
|
||||
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
||||
|
||||
execPath = execPath + " issueSSLForMailServer --virtualHostName " + virtualHost + " --path " + path
|
||||
|
||||
output = subprocess.check_output(shlex.split(execPath))
|
||||
|
||||
if output.find("1,None") > -1:
|
||||
data_ret = {"SSL": 1,
|
||||
'error_message': "None"}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
else:
|
||||
data_ret = {"SSL": 0,
|
||||
'error_message': output}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
## ssl issue ends
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['mailServerSSL'] == 1:
|
||||
pass
|
||||
else:
|
||||
data_ret = {"SSL": 0,
|
||||
'error_message': 'Only administrators can issue Mail Server SSL.'}
|
||||
return ACLManager.loadErrorJson('SSL', 0)
|
||||
|
||||
data = json.loads(request.body)
|
||||
virtualHost = data['virtualHost']
|
||||
|
||||
path = "/home/" + virtualHost + "/public_html"
|
||||
|
||||
## ssl issue
|
||||
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
||||
|
||||
execPath = execPath + " issueSSLForMailServer --virtualHostName " + virtualHost + " --path " + path
|
||||
|
||||
output = subprocess.check_output(shlex.split(execPath))
|
||||
|
||||
if output.find("1,None") > -1:
|
||||
data_ret = {"SSL": 1,
|
||||
'error_message': "None"}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
else:
|
||||
data_ret = {"SSL": 0,
|
||||
'error_message': output}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
## ssl issue ends
|
||||
|
||||
|
||||
except BaseException,msg:
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import os
|
|||
import json
|
||||
from plogical.mailUtilities import mailUtilities
|
||||
import subprocess, shlex
|
||||
from plogical.acl import ACLManager
|
||||
# Create your views here.
|
||||
|
||||
|
||||
|
|
@ -17,15 +18,15 @@ import subprocess, shlex
|
|||
|
||||
def managePowerDNS(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
try:
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if admin.type == 1:
|
||||
return render(request, 'manageServices/managePowerDNS.html', {"status": 1})
|
||||
else:
|
||||
return render(request, 'manageServices/managePowerDNS.html', {"status": 0})
|
||||
|
||||
return render(request, 'manageServices/managePowerDNS.html', {"status": 1})
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return HttpResponse("See CyberCP main log file.")
|
||||
|
|
@ -35,14 +36,16 @@ def managePowerDNS(request):
|
|||
|
||||
def managePostfix(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
try:
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if admin.type == 1:
|
||||
return render(request, 'manageServices/managePostfix.html', {"status": 1})
|
||||
else:
|
||||
return render(request, 'manageServices/managePostfix.html', {"status": 0})
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
try:
|
||||
|
||||
return render(request, 'manageServices/managePostfix.html', {"status": 1})
|
||||
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
|
|
@ -53,15 +56,15 @@ def managePostfix(request):
|
|||
|
||||
def managePureFtpd(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
try:
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if admin.type == 1:
|
||||
return render(request, 'manageServices/managePureFtpd.html', {"status": 1})
|
||||
else:
|
||||
return render(request, 'manageServices/managePureFtpd.html', {"status": 0})
|
||||
|
||||
return render(request, 'manageServices/managePureFtpd.html', {"status": 1})
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return HttpResponse("See CyberCP main log file.")
|
||||
|
|
@ -71,16 +74,16 @@ def managePureFtpd(request):
|
|||
|
||||
def fetchStatus(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
mailUtilities.checkHome()
|
||||
|
||||
data = json.loads(request.body)
|
||||
|
|
@ -129,16 +132,16 @@ def fetchStatus(request):
|
|||
|
||||
def saveStatus(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
if admin.type != 1:
|
||||
dic = {'status': 0, 'error_message': "Only administrator can view this page."}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
data = json.loads(request.body)
|
||||
|
||||
status = data['status']
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ from loginSystem.models import Administrator
|
|||
import json
|
||||
from .models import Package
|
||||
import plogical.CyberCPLogFileWriter as logging
|
||||
from plogical.acl import ACLManager
|
||||
|
||||
# Create your views here.
|
||||
|
||||
|
|
@ -20,59 +21,58 @@ def packagesHome(request):
|
|||
|
||||
return render(request,'packages/index.html',{})
|
||||
|
||||
|
||||
|
||||
def createPacakge(request):
|
||||
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['createPackage'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough privileges to access this page.")
|
||||
return render(request, 'packages/createPackage.html', {"admin": admin.userName})
|
||||
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
return render(request,'packages/createPackage.html',{"admin":admin.userName})
|
||||
|
||||
|
||||
def deletePacakge(request):
|
||||
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
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()
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['deletePackage'] == 1:
|
||||
pass
|
||||
else:
|
||||
packages = Package.objects.filter(admin=admin)
|
||||
return ACLManager.loadError()
|
||||
|
||||
packageList = []
|
||||
for items in packages:
|
||||
packageList.append(items.packageName)
|
||||
packageList = ACLManager.loadPackages(userID, currentACL)
|
||||
return render(request, 'packages/deletePackage.html', {"packageList": packageList})
|
||||
|
||||
except BaseException,msg:
|
||||
logging.writeToFile(str(msg))
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return HttpResponse("Please see CyberCP Main Log File")
|
||||
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
return render(request,'packages/deletePackage.html',{"packageList" : packageList})
|
||||
|
||||
|
||||
|
||||
def submitPackage(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['createPackage'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('saveStatus', 0)
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
data = json.loads(request.body)
|
||||
|
|
@ -84,31 +84,26 @@ def submitPackage(request):
|
|||
emails = int(data['emails'])
|
||||
allowedDomains = int(data['allowedDomains'])
|
||||
|
||||
if admin.type == 1:
|
||||
|
||||
if packageSpace < 0 or packageBandwidth < 0 or packageDatabases < 0 or ftpAccounts < 0 or emails < 0 or allowedDomains < 0:
|
||||
data_ret = {'saveStatus': 0, 'error_message': "All values should be positive or 0."}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
packageName = admin.userName+"_"+packageName
|
||||
|
||||
package = Package(admin=admin, packageName=packageName, diskSpace=packageSpace,
|
||||
bandwidth=packageBandwidth, ftpAccounts=ftpAccounts, dataBases=packageDatabases,emailAccounts=emails,allowedDomains=allowedDomains)
|
||||
|
||||
package.save()
|
||||
|
||||
data_ret = {'saveStatus': 1,'error_message': "None"}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
else:
|
||||
data_ret = {'saveStatus': 0, 'error_message': "Not enough privileges."}
|
||||
if packageSpace < 0 or packageBandwidth < 0 or packageDatabases < 0 or ftpAccounts < 0 or emails < 0 or allowedDomains < 0:
|
||||
data_ret = {'saveStatus': 0, 'error_message': "All values should be positive or 0."}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
packageName = admin.userName + "_" + packageName
|
||||
|
||||
package = Package(admin=admin, packageName=packageName, diskSpace=packageSpace,
|
||||
bandwidth=packageBandwidth, ftpAccounts=ftpAccounts, dataBases=packageDatabases,
|
||||
emailAccounts=emails, allowedDomains=allowedDomains)
|
||||
|
||||
package.save()
|
||||
|
||||
data_ret = {'saveStatus': 1, 'error_message': "None"}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException,msg:
|
||||
data_ret = {'saveStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
|
|
@ -116,26 +111,28 @@ def submitPackage(request):
|
|||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
|
||||
def submitDelete(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if admin.type == 1:
|
||||
if request.method == 'POST':
|
||||
data = json.loads(request.body)
|
||||
packageName = data['packageName']
|
||||
|
||||
delPackage = Package.objects.get(packageName=packageName)
|
||||
delPackage.delete()
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
data_ret = {'deleteStatus': 1,'error_message': "None"}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['deletePackage'] == 1:
|
||||
pass
|
||||
else:
|
||||
data_ret = {'deleteStatus': 0, 'error_message': "Not enough privileges."}
|
||||
return ACLManager.loadErrorJson('deleteStatus', 0)
|
||||
|
||||
if request.method == 'POST':
|
||||
data = json.loads(request.body)
|
||||
packageName = data['packageName']
|
||||
|
||||
delPackage = Package.objects.get(packageName=packageName)
|
||||
delPackage.delete()
|
||||
|
||||
data_ret = {'deleteStatus': 1, 'error_message': "None"}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
|
@ -148,65 +145,57 @@ def submitDelete(request):
|
|||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def modifyPackage(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough privileges to access this page.")
|
||||
|
||||
if admin.type == 1:
|
||||
packages = Package.objects.all()
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['modifyPackage'] == 1:
|
||||
pass
|
||||
else:
|
||||
packages = Package.objects.filter(admin=admin)
|
||||
return ACLManager.loadError()
|
||||
|
||||
packageList = []
|
||||
for items in packages:
|
||||
packageList.append(items.packageName)
|
||||
packageList = ACLManager.loadPackages(userID, currentACL)
|
||||
return render(request, 'packages/modifyPackage.html', {"packList": packageList})
|
||||
|
||||
except BaseException,msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return HttpResponse("Please see CyberCP Main Log File")
|
||||
|
||||
except KeyError:
|
||||
packages = Package.objects.all()
|
||||
|
||||
packageList = []
|
||||
for items in packages:
|
||||
packageList.append(items.packageName)
|
||||
return render(request,'packages/modifyPackage.html',{"packList" : packageList})
|
||||
|
||||
return render(request,'packages/modifyPackage.html',{"packList" : packageList})
|
||||
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def submitModify(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if admin.type == 1:
|
||||
if request.method == 'POST':
|
||||
if request.method == 'POST':
|
||||
|
||||
data = json.loads(request.body)
|
||||
packageName = data['packageName']
|
||||
data = json.loads(request.body)
|
||||
packageName = data['packageName']
|
||||
|
||||
modifyPack = Package.objects.get(packageName=packageName)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
diskSpace = modifyPack.diskSpace
|
||||
bandwidth = modifyPack.bandwidth
|
||||
ftpAccounts = modifyPack.ftpAccounts
|
||||
dataBases = modifyPack.dataBases
|
||||
emails = modifyPack.emailAccounts
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['modifyPackage'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('modifyStatus', 0)
|
||||
|
||||
data_ret = {'emails':emails,'modifyStatus': 1,'error_message': "None",
|
||||
"diskSpace":diskSpace,"bandwidth":bandwidth,"ftpAccounts":ftpAccounts,"dataBases":dataBases,"allowedDomains":modifyPack.allowedDomains}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
else:
|
||||
data_ret = {'modifyStatus': 0, 'error_message': "Not enough privileges."}
|
||||
modifyPack = Package.objects.get(packageName=packageName)
|
||||
|
||||
diskSpace = modifyPack.diskSpace
|
||||
bandwidth = modifyPack.bandwidth
|
||||
ftpAccounts = modifyPack.ftpAccounts
|
||||
dataBases = modifyPack.dataBases
|
||||
emails = modifyPack.emailAccounts
|
||||
|
||||
data_ret = {'emails': emails, 'modifyStatus': 1, 'error_message': "None",
|
||||
"diskSpace": diskSpace, "bandwidth": bandwidth, "ftpAccounts": ftpAccounts,
|
||||
"dataBases": dataBases, "allowedDomains": modifyPack.allowedDomains}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
|
@ -223,34 +212,38 @@ def submitModify(request):
|
|||
|
||||
def saveChanges(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
if admin.type == 1:
|
||||
if request.method == 'POST':
|
||||
data = json.loads(request.body)
|
||||
packageName = data['packageName']
|
||||
if request.method == 'POST':
|
||||
data = json.loads(request.body)
|
||||
packageName = data['packageName']
|
||||
|
||||
if data['diskSpace'] < 0 or data['bandwidth'] < 0 or data['ftpAccounts'] < 0 or data['dataBases'] < 0 or data['emails'] < 0 or data['allowedDomains'] < 0:
|
||||
data_ret = {'saveStatus': 0, 'error_message': "All values should be positive or 0."}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
modifyPack = Package.objects.get(packageName=packageName)
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
elif currentACL['modifyPackage'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('saveStatus', 0)
|
||||
|
||||
modifyPack.diskSpace = data['diskSpace']
|
||||
modifyPack.bandwidth = data['bandwidth']
|
||||
modifyPack.ftpAccounts = data['ftpAccounts']
|
||||
modifyPack.dataBases = data['dataBases']
|
||||
modifyPack.emailAccounts = data['emails']
|
||||
modifyPack.allowedDomains = data['allowedDomains']
|
||||
modifyPack.save()
|
||||
|
||||
data_ret = {'saveStatus': 1,'error_message': "None"}
|
||||
if data['diskSpace'] < 0 or data['bandwidth'] < 0 or data['ftpAccounts'] < 0 or data['dataBases'] < 0 or \
|
||||
data['emails'] < 0 or data['allowedDomains'] < 0:
|
||||
data_ret = {'saveStatus': 0, 'error_message': "All values should be positive or 0."}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
else:
|
||||
data_ret = {'saveStatus': 0,'error_message': "Not enough privileges."}
|
||||
|
||||
modifyPack = Package.objects.get(packageName=packageName)
|
||||
|
||||
modifyPack.diskSpace = data['diskSpace']
|
||||
modifyPack.bandwidth = data['bandwidth']
|
||||
modifyPack.ftpAccounts = data['ftpAccounts']
|
||||
modifyPack.dataBases = data['dataBases']
|
||||
modifyPack.emailAccounts = data['emails']
|
||||
modifyPack.allowedDomains = data['allowedDomains']
|
||||
modifyPack.save()
|
||||
|
||||
data_ret = {'saveStatus': 1, 'error_message': "None"}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,372 @@
|
|||
#!/usr/local/CyberCP/bin/python2
|
||||
import os,sys
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
import django
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||
django.setup()
|
||||
from loginSystem.models import Administrator, ACL
|
||||
from django.shortcuts import HttpResponse
|
||||
from packages.models import Package
|
||||
from websiteFunctions.models import Websites
|
||||
from dns.models import Domains
|
||||
import json
|
||||
|
||||
class ACLManager:
|
||||
|
||||
@staticmethod
|
||||
def loadedACL(val):
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
finalResponse = {}
|
||||
finalResponse['firstName'] = admin.firstName
|
||||
finalResponse['lastName'] = admin.lastName
|
||||
|
||||
try:
|
||||
ipFile = "/etc/cyberpanel/machineIP"
|
||||
f = open(ipFile)
|
||||
ipData = f.read()
|
||||
serverIPAddress = ipData.split('\n', 1)[0]
|
||||
except BaseException, msg:
|
||||
serverIPAddress = "192.168.100.1"
|
||||
|
||||
finalResponse['serverIPAddress'] = serverIPAddress
|
||||
finalResponse['adminName'] = admin.firstName + " " + admin.lastName[:3]
|
||||
|
||||
if admin.acl.adminStatus == 1:
|
||||
finalResponse['admin'] = 1
|
||||
else:
|
||||
finalResponse['admin'] = 0
|
||||
|
||||
acl = ACL.objects.get(name=admin.acl.name)
|
||||
finalResponse['versionManagement'] = acl.versionManagement
|
||||
|
||||
## User Management
|
||||
|
||||
finalResponse['createNewUser'] = acl.createNewUser
|
||||
finalResponse['deleteUser'] = acl.deleteUser
|
||||
finalResponse['changeUserACL'] = acl.changeUserACL
|
||||
finalResponse['resellerCenter'] = acl.resellerCenter
|
||||
|
||||
## Website Management
|
||||
|
||||
finalResponse['createWebsite'] = acl.createWebsite
|
||||
finalResponse['modifyWebsite'] = acl.modifyWebsite
|
||||
finalResponse['suspendWebsite'] = acl.suspendWebsite
|
||||
finalResponse['deleteWebsite'] = acl.deleteWebsite
|
||||
|
||||
## Package Management
|
||||
|
||||
|
||||
finalResponse['createPackage'] = acl.createPackage
|
||||
finalResponse['deletePackage'] = acl.deletePackage
|
||||
finalResponse['modifyPackage'] = acl.modifyPackage
|
||||
|
||||
## Database Management
|
||||
|
||||
finalResponse['createDatabase'] = acl.createDatabase
|
||||
finalResponse['deleteDatabase'] = acl.deleteDatabase
|
||||
finalResponse['listDatabases'] = acl.listDatabases
|
||||
|
||||
## DNS Management
|
||||
|
||||
finalResponse['createNameServer'] = acl.createNameServer
|
||||
finalResponse['createDNSZone'] = acl.createDNSZone
|
||||
finalResponse['deleteZone'] = acl.deleteZone
|
||||
finalResponse['addDeleteRecords'] = acl.addDeleteRecords
|
||||
|
||||
## Email Management
|
||||
|
||||
finalResponse['createEmail'] = acl.createEmail
|
||||
finalResponse['deleteEmail'] = acl.deleteEmail
|
||||
finalResponse['emailForwarding'] = acl.emailForwarding
|
||||
finalResponse['changeEmailPassword'] = acl.changeEmailPassword
|
||||
finalResponse['dkimManager'] = acl.dkimManager
|
||||
|
||||
## FTP Management
|
||||
|
||||
finalResponse['createFTPAccount'] = acl.createFTPAccount
|
||||
finalResponse['deleteFTPAccount'] = acl.deleteFTPAccount
|
||||
finalResponse['listFTPAccounts'] = acl.listFTPAccounts
|
||||
|
||||
## Backup Management
|
||||
|
||||
finalResponse['createBackup'] = acl.createBackup
|
||||
finalResponse['restoreBackup'] = acl.restoreBackup
|
||||
finalResponse['addDeleteDestinations'] = acl.addDeleteDestinations
|
||||
finalResponse['scheDuleBackups'] = acl.scheDuleBackups
|
||||
finalResponse['remoteBackups'] = acl.remoteBackups
|
||||
|
||||
## SSL Management
|
||||
|
||||
finalResponse['manageSSL'] = acl.manageSSL
|
||||
finalResponse['hostnameSSL'] = acl.hostnameSSL
|
||||
finalResponse['mailServerSSL'] = acl.mailServerSSL
|
||||
|
||||
return finalResponse
|
||||
|
||||
@staticmethod
|
||||
def createDefaultACLs():
|
||||
try:
|
||||
|
||||
## Admin ACL
|
||||
|
||||
newACL = ACL(name='admin', adminStatus=1)
|
||||
newACL.save()
|
||||
|
||||
## Reseller ACL
|
||||
|
||||
newACL = ACL(name='reseller',
|
||||
createNewUser=1,
|
||||
deleteUser=1,
|
||||
createWebsite=1,
|
||||
resellerCenter=1,
|
||||
modifyWebsite=1,
|
||||
suspendWebsite=1,
|
||||
deleteWebsite=1,
|
||||
createPackage=1,
|
||||
deletePackage=1,
|
||||
modifyPackage=1,
|
||||
createNameServer=1,
|
||||
restoreBackup=1,
|
||||
)
|
||||
newACL.save()
|
||||
|
||||
## User ACL
|
||||
newACL = ACL(name='user')
|
||||
newACL.save()
|
||||
except:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def loadError():
|
||||
try:
|
||||
return HttpResponse('You are not authorized to access this resource.')
|
||||
except:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def loadErrorJson(additionalParameter = None, additionalParameterValue = None):
|
||||
try:
|
||||
if additionalParameter == None:
|
||||
finalJson = {"status": 0, "errorMessage": 'You are not authorized to access this resource.',
|
||||
'error_message': 'You are not authorized to access this resource.',
|
||||
}
|
||||
else:
|
||||
finalJson = {"status": 0, "errorMessage": 'You are not authorized to access this resource.',
|
||||
'error_message': 'You are not authorized to access this resource.',
|
||||
additionalParameter: additionalParameterValue
|
||||
}
|
||||
|
||||
json_data = json.dumps(finalJson)
|
||||
return HttpResponse(json_data)
|
||||
except:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def findAllUsers():
|
||||
userNames = []
|
||||
allUsers = Administrator.objects.all()
|
||||
for items in allUsers:
|
||||
if items.userName == 'admin':
|
||||
continue
|
||||
userNames.append(items.userName)
|
||||
return userNames
|
||||
|
||||
@staticmethod
|
||||
def findAllACLs():
|
||||
aclNames = []
|
||||
allACLs = ACL.objects.all()
|
||||
|
||||
for items in allACLs:
|
||||
if items.name == 'admin' or items.name == 'reseller' or items.name == 'user':
|
||||
continue
|
||||
else:
|
||||
aclNames.append(items.name)
|
||||
return aclNames
|
||||
|
||||
@staticmethod
|
||||
def unFileteredACLs():
|
||||
aclNames = []
|
||||
allACLs = ACL.objects.all()
|
||||
|
||||
for items in allACLs:
|
||||
aclNames.append(items.name)
|
||||
|
||||
return aclNames
|
||||
|
||||
@staticmethod
|
||||
def loadAllUsers(userID):
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
adminNames = []
|
||||
|
||||
finalResponse = ACLManager.loadedACL(userID)
|
||||
|
||||
if finalResponse['admin'] == 1:
|
||||
admins = Administrator.objects.all()
|
||||
for items in admins:
|
||||
if items.userName == admin.userName:
|
||||
continue
|
||||
adminNames.append(items.userName)
|
||||
else:
|
||||
admins = Administrator.objects.filter(owner=admin.pk)
|
||||
for items in admins:
|
||||
adminNames.append(items.userName)
|
||||
|
||||
adminNames.append(admin.userName)
|
||||
return adminNames
|
||||
|
||||
@staticmethod
|
||||
def loadDeletionUsers(userID, finalResponse):
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
adminNames = []
|
||||
|
||||
if finalResponse['admin'] == 1:
|
||||
admins = Administrator.objects.all()
|
||||
for items in admins:
|
||||
if items.userName == admin.userName:
|
||||
continue
|
||||
adminNames.append(items.userName)
|
||||
else:
|
||||
admins = Administrator.objects.filter(owner=admin.pk)
|
||||
for items in admins:
|
||||
adminNames.append(items.userName)
|
||||
|
||||
return adminNames
|
||||
|
||||
@staticmethod
|
||||
def userWithResellerPriv(userID):
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
adminNames = []
|
||||
|
||||
finalResponse = ACLManager.loadedACL(userID)
|
||||
|
||||
if finalResponse['admin'] == 1:
|
||||
admins = Administrator.objects.all()
|
||||
for items in admins:
|
||||
if items.acl.resellerCenter == 1:
|
||||
if items.userName == admin.userName:
|
||||
continue
|
||||
adminNames.append(items.userName)
|
||||
else:
|
||||
admins = Administrator.objects.filter(owner=admin.pk)
|
||||
for items in admins:
|
||||
if items.acl.resellerCenter == 1:
|
||||
adminNames.append(items.userName)
|
||||
|
||||
adminNames.append(admin.userName)
|
||||
return adminNames
|
||||
|
||||
@staticmethod
|
||||
def websitesLimitCheck(currentAdmin, websitesLimit, userToBeModified = None):
|
||||
if currentAdmin.acl.adminStatus != 1:
|
||||
|
||||
if currentAdmin.initWebsitesLimit != 0:
|
||||
webLimits = 0
|
||||
allUsers = Administrator.objects.filter(owner=currentAdmin.pk)
|
||||
for items in allUsers:
|
||||
webLimits = webLimits + items.initWebsitesLimit
|
||||
|
||||
if userToBeModified != None:
|
||||
webLimits = webLimits - userToBeModified.initWebsitesLimit
|
||||
|
||||
webLimits = webLimits + websitesLimit + currentAdmin.websites_set.all().count()
|
||||
|
||||
if webLimits <= currentAdmin.initWebsitesLimit:
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
else:
|
||||
return 1
|
||||
else:
|
||||
return 1
|
||||
|
||||
@staticmethod
|
||||
def loadPackages(userID, finalResponse):
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
packNames = []
|
||||
|
||||
if finalResponse['admin'] == 1:
|
||||
packs = Package.objects.all()
|
||||
for items in packs:
|
||||
packNames.append(items.packageName)
|
||||
else:
|
||||
packs = admin.package_set.all()
|
||||
for items in packs:
|
||||
packNames.append(items.packageName)
|
||||
|
||||
return packNames
|
||||
|
||||
@staticmethod
|
||||
def findAllSites(currentACL, userID):
|
||||
websiteNames = []
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
allWebsites = Websites.objects.all()
|
||||
for items in allWebsites:
|
||||
websiteNames.append(items.domain)
|
||||
else:
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
websites = admin.websites_set.all()
|
||||
admins = Administrator.objects.filter(owner=admin.pk)
|
||||
|
||||
for items in websites:
|
||||
websiteNames.append(items.domain)
|
||||
|
||||
for items in admins:
|
||||
webs = items.websites_set.all()
|
||||
for web in webs:
|
||||
websiteNames.append(web.domain)
|
||||
|
||||
|
||||
return websiteNames
|
||||
|
||||
@staticmethod
|
||||
def findWebsiteObjects(currentACL, userID):
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
return Websites.objects.all()
|
||||
else:
|
||||
|
||||
websiteList = []
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
websites = admin.websites_set.all()
|
||||
|
||||
for items in websites:
|
||||
websiteList.append(items)
|
||||
|
||||
admins = Administrator.objects.filter(owner=admin.pk)
|
||||
|
||||
for items in admins:
|
||||
webs = items.websites_set.all()
|
||||
for web in webs:
|
||||
websiteList.append(web)
|
||||
|
||||
return websiteList
|
||||
|
||||
@staticmethod
|
||||
def findAllDomains(currentACL, userID):
|
||||
domainsList = []
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
domains = Domains.objects.all()
|
||||
for items in domains:
|
||||
domainsList.append(items.name)
|
||||
else:
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
domains = admin.domains_set.all()
|
||||
|
||||
for items in domains:
|
||||
domainsList.append(items.name)
|
||||
|
||||
admins = Administrator.objects.filter(owner=admin.pk)
|
||||
|
||||
for items in admins:
|
||||
doms = items.domains_set.all()
|
||||
for dom in doms:
|
||||
domainsList.append(dom.name)
|
||||
|
||||
return domainsList
|
||||
|
||||
|
||||
|
|
@ -7,33 +7,37 @@ from django.http import HttpResponse
|
|||
import json
|
||||
import plogical.CyberCPLogFileWriter as logging
|
||||
from plogical.installUtilities import installUtilities
|
||||
from loginSystem.models import Administrator
|
||||
import subprocess
|
||||
import shlex
|
||||
from plogical.virtualHostUtilities import virtualHostUtilities
|
||||
from plogical.acl import ACLManager
|
||||
# Create your views here.
|
||||
|
||||
|
||||
def logsHome(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.")
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
return render(request,'serverLogs/index.html')
|
||||
|
||||
|
||||
def accessLogs(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough privileges to access this page.")
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
return render(request,'serverLogs/accessLogs.html')
|
||||
|
||||
|
|
@ -41,15 +45,15 @@ def accessLogs(request):
|
|||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[accessLogs]")
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def errorLogs(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough privileges to access this page.")
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
|
||||
return render(request,'serverLogs/errorLogs.html')
|
||||
|
|
@ -60,13 +64,13 @@ def errorLogs(request):
|
|||
|
||||
def ftplogs(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.")
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
return render(request,'serverLogs/ftplogs.html')
|
||||
|
||||
|
|
@ -76,12 +80,13 @@ def ftplogs(request):
|
|||
|
||||
def emailLogs(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough privileges to access this page.")
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
|
||||
return render(request,'serverLogs/emailLogs.html')
|
||||
|
|
@ -92,13 +97,13 @@ def emailLogs(request):
|
|||
|
||||
def modSecAuditLogs(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.")
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
return render(request,'serverLogs/modSecAuditLog.html')
|
||||
|
||||
|
|
@ -106,41 +111,37 @@ def modSecAuditLogs(request):
|
|||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[accessLogs]")
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def getLogsFromFile(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
|
||||
admin = Administrator.objects.get(id=val)
|
||||
|
||||
if admin.type == 1:
|
||||
data = json.loads(request.body)
|
||||
type = data['type']
|
||||
|
||||
if type=="access":
|
||||
fileName = installUtilities.Server_root_path+"/logs/access.log"
|
||||
elif type=="error":
|
||||
fileName = installUtilities.Server_root_path + "/logs/error.log"
|
||||
elif type=="email":
|
||||
fileName="/var/log/maillog"
|
||||
elif type=="ftp":
|
||||
fileName="/var/log/messages"
|
||||
elif type == "modSec":
|
||||
fileName = "/usr/local/lsws/logs/auditmodsec.log"
|
||||
|
||||
|
||||
command = "sudo tail -50 " + fileName
|
||||
|
||||
fewLinesOfLogFile = subprocess.check_output(shlex.split(command))
|
||||
|
||||
status = {"logstatus":1,"logsdata":fewLinesOfLogFile}
|
||||
final_json = json.dumps(status)
|
||||
return HttpResponse(final_json)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
status = {"logstatus": 0, 'error': "You don't have enough privileges to access this page."}
|
||||
final_json = json.dumps(status)
|
||||
return HttpResponse(final_json)
|
||||
return ACLManager.loadErrorJson('logstatus', 0)
|
||||
|
||||
data = json.loads(request.body)
|
||||
type = data['type']
|
||||
|
||||
if type == "access":
|
||||
fileName = installUtilities.Server_root_path + "/logs/access.log"
|
||||
elif type == "error":
|
||||
fileName = installUtilities.Server_root_path + "/logs/error.log"
|
||||
elif type == "email":
|
||||
fileName = "/var/log/maillog"
|
||||
elif type == "ftp":
|
||||
fileName = "/var/log/messages"
|
||||
elif type == "modSec":
|
||||
fileName = "/usr/local/lsws/logs/auditmodsec.log"
|
||||
|
||||
command = "sudo tail -50 " + fileName
|
||||
|
||||
fewLinesOfLogFile = subprocess.check_output(shlex.split(command))
|
||||
|
||||
status = {"logstatus": 1, "logsdata": fewLinesOfLogFile}
|
||||
final_json = json.dumps(status)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
except KeyError, msg:
|
||||
|
|
@ -150,34 +151,35 @@ def getLogsFromFile(request):
|
|||
|
||||
def clearLogFile(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('cleanStatus', 0)
|
||||
|
||||
try:
|
||||
if admin.type == 1:
|
||||
if request.method == 'POST':
|
||||
if request.method == 'POST':
|
||||
|
||||
data = json.loads(request.body)
|
||||
data = json.loads(request.body)
|
||||
|
||||
fileName = data['fileName']
|
||||
fileName = data['fileName']
|
||||
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/serverLogs.py"
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/serverLogs.py"
|
||||
|
||||
execPath = execPath + " cleanLogFile --fileName " + fileName
|
||||
execPath = execPath + " cleanLogFile --fileName " + fileName
|
||||
|
||||
output = subprocess.check_output(shlex.split(execPath))
|
||||
output = subprocess.check_output(shlex.split(execPath))
|
||||
|
||||
if output.find("1,None") > -1:
|
||||
data_ret = {'cleanStatus': 1, 'error_message': "None"}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
else:
|
||||
data_ret = {'cleanStatus': 0, 'error_message': output}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
else:
|
||||
data_ret = {'cleanStatus': 0, 'error_message': 'Not enough privileges.'}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
if output.find("1,None") > -1:
|
||||
data_ret = {'cleanStatus': 1, 'error_message': "None"}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
else:
|
||||
data_ret = {'cleanStatus': 0, 'error_message': output}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException,msg:
|
||||
data_ret = {'cleanStatus': 0, 'error_message': str(msg)}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
<div id="page-title">
|
||||
<h2>Services <img ng-show="actionLoader" src="/static/images/loading.gif"></h2>
|
||||
|
||||
<p>Show stats for services and actions (Start, Stop, Restart)</p>
|
||||
<p>{% trans 'Show stats for services and actions (Start, Stop, Restart)' %}</p>
|
||||
</div>
|
||||
|
||||
<div >
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
</div>
|
||||
<div class="serviceDetails">
|
||||
<div class="serviceHeading">
|
||||
<h5><b>OpenLitespeed</b></h5>
|
||||
<h5><b>LiteSpeed Ent</b></h5>
|
||||
<span class="help-block" ng-bind="olsStatus">Stopped</span>
|
||||
</div>
|
||||
<div class="serviceActionBtn">
|
||||
|
|
|
|||
|
|
@ -8,23 +8,15 @@ import plogical.CyberCPLogFileWriter as logging
|
|||
from loginSystem.views import loadLoginPage
|
||||
import json
|
||||
import subprocess
|
||||
from loginSystem.models import Administrator
|
||||
import psutil
|
||||
import shlex
|
||||
import socket
|
||||
from plogical.acl import ACLManager
|
||||
# Create your views here.
|
||||
|
||||
|
||||
def serverStatusHome(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough priviliges to access this page.")
|
||||
|
||||
|
||||
return render(request,'serverStatus/index.html')
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
|
@ -34,10 +26,12 @@ def litespeedStatus(request):
|
|||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough priviliges to access this page.")
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
processList = ProcessUtilities.getLitespeedProcessNumber()
|
||||
|
||||
|
|
@ -75,16 +69,16 @@ def litespeedStatus(request):
|
|||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[litespeedStatus]")
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
|
||||
def stopOrRestartLitespeed(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough priviliges to access this page.")
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('reboot', 0)
|
||||
|
||||
data = json.loads(request.body)
|
||||
|
||||
|
|
@ -108,17 +102,17 @@ def stopOrRestartLitespeed(request):
|
|||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[stopOrRestartLitespeed]")
|
||||
return HttpResponse("Not Logged in as admin")
|
||||
|
||||
|
||||
|
||||
def cyberCPMainLogFile(request):
|
||||
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough privileges to access this page.")
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
|
||||
return render(request,'serverStatus/cybercpmainlogfile.html')
|
||||
|
|
@ -127,56 +121,45 @@ def cyberCPMainLogFile(request):
|
|||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[cyberCPMainLogFile]")
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def getFurtherDataFromLogFile(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if admin.type == 1:
|
||||
|
||||
fewLinesOfLogFile = logging.CyberCPLogFileWriter.readLastNFiles(50,logging.CyberCPLogFileWriter.fileName)
|
||||
fewLinesOfLogFile = str(fewLinesOfLogFile)
|
||||
status = {"logstatus": 1, "logsdata": fewLinesOfLogFile}
|
||||
final_json = json.dumps(status)
|
||||
return HttpResponse(final_json)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
status = {"logstatus": 0,'error':"You don't have enough privilege to view logs."}
|
||||
final_json = json.dumps(status)
|
||||
return HttpResponse(final_json)
|
||||
return ACLManager.loadErrorJson('logstatus', 0)
|
||||
|
||||
fewLinesOfLogFile = logging.CyberCPLogFileWriter.readLastNFiles(50, logging.CyberCPLogFileWriter.fileName)
|
||||
fewLinesOfLogFile = str(fewLinesOfLogFile)
|
||||
status = {"logstatus": 1, "logsdata": fewLinesOfLogFile}
|
||||
final_json = json.dumps(status)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except KeyError, msg:
|
||||
status = {"logstatus":0,"error":"Could not fetch data from log file, please see CyberCP main log file through command line."}
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[getFurtherDataFromLogFile]")
|
||||
return HttpResponse("Not Logged in as admin")
|
||||
|
||||
|
||||
def services(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough priviliges to access this page.")
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
return render(request, 'serverStatus/services.html')
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def servicesStatus(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
if admin.type == 3:
|
||||
final = {'error': 1, "error_message": "Not enough privilege"}
|
||||
final_json = json.dumps(final)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
lsStatus = []
|
||||
sqlStatus = []
|
||||
dnsStatus = []
|
||||
|
|
@ -257,17 +240,15 @@ def servicesStatus(request):
|
|||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def servicesAction(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if admin.type == 3:
|
||||
final = {'serviceAction': 0, "error_message": "Not enough privileges."}
|
||||
final_json = json.dumps(final)
|
||||
return HttpResponse(final_json)
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('serviceAction', 0)
|
||||
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
|
|
|||
|
|
@ -70,16 +70,13 @@ app.controller('systemStatusInfo', function($scope,$http,$timeout) {
|
|||
|
||||
function ListInitialData(response) {
|
||||
|
||||
|
||||
$scope.cpuUsage = response.data.cpuUsage;
|
||||
$scope.ramUsage = response.data.ramUsage;
|
||||
$scope.diskUsage = response.data.diskUsage;
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialData(response) {
|
||||
console.log("not good");
|
||||
}
|
||||
function cantLoadInitialData(response) {}
|
||||
|
||||
//$timeout(getStuff, 2000);
|
||||
|
||||
|
|
@ -103,52 +100,173 @@ app.controller('adminController', function($scope,$http,$timeout) {
|
|||
function ListInitialData(response) {
|
||||
|
||||
|
||||
$scope.currentAdmin = response.data.user_name;
|
||||
$scope.currentAdmin = response.data.adminName;
|
||||
$scope.admin_type = response.data.admin_type;
|
||||
|
||||
|
||||
$("#serverIPAddress").text(response.data.serverIPAddress);
|
||||
|
||||
if (response.data.admin_type !== "Administrator")
|
||||
{
|
||||
if (response.data.admin === 0) {
|
||||
$('.serverACL').hide();
|
||||
|
||||
if(response.data.admin_type !== "Reseller") {
|
||||
$("#normalUser").hide();
|
||||
$("#normalUserA").hide();
|
||||
$("#normalUserB").hide();
|
||||
|
||||
if(!Boolean(response.data.versionManagement)){
|
||||
$('.versionManagement').hide();
|
||||
}
|
||||
// User Management
|
||||
if(!Boolean(response.data.createNewUser)){
|
||||
$('.createNewUser').hide();
|
||||
}
|
||||
if(!Boolean(response.data.resellerCenter)){
|
||||
$('.resellerCenter').hide();
|
||||
}
|
||||
if(!Boolean(response.data.deleteUser)){
|
||||
$('.deleteUser').hide();
|
||||
}
|
||||
if(!Boolean(response.data.changeUserACL)){
|
||||
$('.changeUserACL').hide();
|
||||
}
|
||||
// Website Management
|
||||
if(!Boolean(response.data.createWebsite)){
|
||||
$('.createWebsite').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.modifyWebsite)){
|
||||
$('.modifyWebsite').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.suspendWebsite)){
|
||||
$('.suspendWebsite').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.deleteWebsite)){
|
||||
$('.deleteWebsite').hide();
|
||||
}
|
||||
|
||||
$("#normalUserC").hide();
|
||||
$("#normalUserD").hide();
|
||||
$("#normalUserE").hide();
|
||||
$("#normalUserF").hide();
|
||||
$("#normalUserG").hide();
|
||||
$("#normalUserH").hide();
|
||||
$("#normalUserP").hide();
|
||||
$("#normalUserI").hide();
|
||||
// Package Management
|
||||
|
||||
$("#ssl").hide();
|
||||
$("#sslA").hide();
|
||||
$("#siteState").hide();
|
||||
if(!Boolean(response.data.createPackage)){
|
||||
$('.createPackage').hide();
|
||||
}
|
||||
|
||||
$("#restoreSite").hide();
|
||||
$("#backupDestinations").hide();
|
||||
$("#scheduleBackup").hide();
|
||||
if(!Boolean(response.data.deletePackage)){
|
||||
$('.deletePackage').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.modifyPackage)){
|
||||
$('.modifyPackage').hide();
|
||||
}
|
||||
|
||||
// Database Management
|
||||
|
||||
if(!Boolean(response.data.createDatabase)){
|
||||
$('.createDatabase').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.deleteDatabase)){
|
||||
$('.deleteDatabase').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.listDatabases)){
|
||||
$('.listDatabases').hide();
|
||||
}
|
||||
|
||||
// DNS Management
|
||||
|
||||
if(!Boolean(response.data.createNameServer)){
|
||||
$('.createNameServer').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.createDNSZone)){
|
||||
$('.createDNSZone').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.deleteZone)){
|
||||
$('.addDeleteRecords').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.addDeleteRecords)){
|
||||
$('.deleteDatabase').hide();
|
||||
}
|
||||
|
||||
// Email Management
|
||||
|
||||
if(!Boolean(response.data.createEmail)){
|
||||
$('.createEmail').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.deleteEmail)){
|
||||
$('.deleteEmail').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.emailForwarding)){
|
||||
$('.emailForwarding').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.changeEmailPassword)){
|
||||
$('.changeEmailPassword').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.dkimManager)){
|
||||
$('.dkimManager').hide();
|
||||
}
|
||||
|
||||
|
||||
// FTP Management
|
||||
|
||||
if(!Boolean(response.data.createFTPAccount)){
|
||||
$('.createFTPAccount').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.deleteFTPAccount)){
|
||||
$('.deleteFTPAccount').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.listFTPAccounts)){
|
||||
$('.listFTPAccounts').hide();
|
||||
}
|
||||
|
||||
// Backup Management
|
||||
|
||||
if(!Boolean(response.data.createBackup)){
|
||||
$('.createBackup').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.restoreBackup)){
|
||||
$('.restoreBackup').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.addDeleteDestinations)){
|
||||
$('.addDeleteDestinations').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.scheDuleBackups)){
|
||||
$('.scheDuleBackups').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.remoteBackups)){
|
||||
$('.remoteBackups').hide();
|
||||
}
|
||||
|
||||
|
||||
// SSL Management
|
||||
|
||||
if(!Boolean(response.data.manageSSL)){
|
||||
$('.manageSSL').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.hostnameSSL)){
|
||||
$('.hostnameSSL').hide();
|
||||
}
|
||||
|
||||
if(!Boolean(response.data.mailServerSSL)){
|
||||
$('.mailServerSSL').hide();
|
||||
}
|
||||
|
||||
$("#remoteBackups").hide();
|
||||
$("#packageHome").hide();
|
||||
$("#packageSub").hide();
|
||||
$("#createWebsite").hide();
|
||||
$("#modifyWebSite").hide();
|
||||
$("#deleteWebsite").hide();
|
||||
$("#versionManagement").hide();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function cantLoadInitialData(response) {
|
||||
console.log("not good");
|
||||
}
|
||||
function cantLoadInitialData(response) {}
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -288,8 +288,7 @@ app.controller('addModifyDNSRecords', function($scope,$http) {
|
|||
data.priority = $scope.priority;
|
||||
data.ttl = $scope.ttl;
|
||||
data.recordType = type;
|
||||
}
|
||||
else if(type === "CAA"){
|
||||
}else if(type === "CAA"){
|
||||
data.selectedZone = $scope.selectedZone;
|
||||
data.recordName = $scope.recordName;
|
||||
data.recordContentCAA = $scope.recordContentCAA;
|
||||
|
|
|
|||
|
|
@ -985,15 +985,10 @@ app.controller('modSec', function($scope, $http, $timeout, $window) {
|
|||
|
||||
///// ModSec configs
|
||||
|
||||
var modsecurity_status = false;
|
||||
var SecAuditEngine = false;
|
||||
var SecRuleEngine = false;
|
||||
|
||||
|
||||
$('#modsecurity_status').change(function() {
|
||||
modsecurity_status = $(this).prop('checked');
|
||||
});
|
||||
|
||||
$('#SecAuditEngine').change(function() {
|
||||
SecAuditEngine = $(this).prop('checked');
|
||||
});
|
||||
|
|
@ -1008,7 +1003,6 @@ app.controller('modSec', function($scope, $http, $timeout, $window) {
|
|||
|
||||
$scope.modsecLoading = false;
|
||||
|
||||
$('#modsecurity_status').bootstrapToggle('off');
|
||||
$('#SecAuditEngine').bootstrapToggle('off');
|
||||
$('#SecRuleEngine').bootstrapToggle('off');
|
||||
|
||||
|
|
@ -1037,10 +1031,6 @@ app.controller('modSec', function($scope, $http, $timeout, $window) {
|
|||
|
||||
if(response.data.installed === 1) {
|
||||
|
||||
|
||||
if (response.data.modsecurity === 1) {
|
||||
$('#modsecurity_status').bootstrapToggle('on');
|
||||
}
|
||||
if (response.data.SecAuditEngine === 1) {
|
||||
$('#SecAuditEngine').bootstrapToggle('on');
|
||||
}
|
||||
|
|
@ -1083,13 +1073,12 @@ app.controller('modSec', function($scope, $http, $timeout, $window) {
|
|||
url = "/firewall/saveModSecConfigurations";
|
||||
|
||||
var data = {
|
||||
modsecurity_status:modsecurity_status,
|
||||
SecAuditEngine:SecAuditEngine,
|
||||
SecRuleEngine:SecRuleEngine,
|
||||
SecDebugLogLevel:$scope.SecDebugLogLevel,
|
||||
SecAuditLogParts:$scope.SecAuditLogParts,
|
||||
SecAuditLogRelevantStatus:$scope.SecAuditLogRelevantStatus,
|
||||
SecAuditLogType:$scope.SecAuditLogType,
|
||||
SecAuditLogType:$scope.SecAuditLogType
|
||||
};
|
||||
|
||||
var config = {
|
||||
|
|
@ -1494,8 +1483,6 @@ app.controller('modSecRulesPack', function($scope, $http, $timeout, $window) {
|
|||
|
||||
$scope.modsecLoading = false;
|
||||
|
||||
|
||||
|
||||
url = "/firewall/enableDisableRuleFile";
|
||||
|
||||
var data = {
|
||||
|
|
@ -1529,6 +1516,12 @@ app.controller('modSecRulesPack', function($scope, $http, $timeout, $window) {
|
|||
$scope.installationFailed = true;
|
||||
$scope.installationSuccess = false;
|
||||
|
||||
new PNotify({
|
||||
title: 'Success!',
|
||||
text: 'Changes successfully applied.',
|
||||
type:'success'
|
||||
});
|
||||
|
||||
$scope.fetchRulesFile(packName);
|
||||
|
||||
}else{
|
||||
|
|
@ -1541,6 +1534,12 @@ app.controller('modSecRulesPack', function($scope, $http, $timeout, $window) {
|
|||
$scope.installationFailed = false;
|
||||
$scope.installationSuccess = true;
|
||||
|
||||
new PNotify({
|
||||
title: 'Error!',
|
||||
text: response.data.error_message,
|
||||
type:'error'
|
||||
});
|
||||
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
}
|
||||
|
||||
|
|
@ -1554,6 +1553,12 @@ app.controller('modSecRulesPack', function($scope, $http, $timeout, $window) {
|
|||
$scope.couldNotConnect = false;
|
||||
$scope.installationFailed = true;
|
||||
$scope.installationSuccess = true;
|
||||
|
||||
new PNotify({
|
||||
title: 'Error!',
|
||||
text: 'Could not connect to server, please refresh this page.',
|
||||
type:'error'
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -537,8 +537,6 @@ app.controller('modifyWebsitesController', function($scope,$http) {
|
|||
|
||||
});
|
||||
|
||||
|
||||
|
||||
/* Java script code to Modify Pacakge ends here */
|
||||
|
||||
|
||||
|
|
@ -723,7 +721,7 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) {
|
|||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if(response.data.logstatus == 1){
|
||||
if(response.data.logstatus === 1){
|
||||
|
||||
|
||||
// notifications
|
||||
|
|
@ -839,7 +837,7 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) {
|
|||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if(response.data.configstatus == 1){
|
||||
if(response.data.configstatus === 1){
|
||||
|
||||
//Rewrite rules
|
||||
|
||||
|
|
@ -956,7 +954,7 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) {
|
|||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if(response.data.configstatus == 1){
|
||||
if(response.data.configstatus === 1){
|
||||
|
||||
$scope.configurationsBox = false;
|
||||
$scope.configsFetched = true;
|
||||
|
|
@ -1366,10 +1364,10 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) {
|
|||
|
||||
var domain = $("#domainNamePage").text();
|
||||
var path = $scope.installPath;
|
||||
var sitename = $scope.sitename
|
||||
var username = $scope.username
|
||||
var password = $scope.password
|
||||
var prefix = $scope.prefix
|
||||
var sitename = $scope.sitename;
|
||||
var username = $scope.username;
|
||||
var password = $scope.password;
|
||||
var prefix = $scope.prefix;
|
||||
|
||||
|
||||
url = "/websites/installJoomla";
|
||||
|
|
@ -1480,7 +1478,7 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) {
|
|||
var data = {
|
||||
virtualHost: virtualHost,
|
||||
cert:cert,
|
||||
key:key,
|
||||
key:key
|
||||
};
|
||||
|
||||
var config = {
|
||||
|
|
@ -2377,9 +2375,8 @@ app.controller('suspendWebsiteControl', function($scope,$http) {
|
|||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
console.log(response.data)
|
||||
|
||||
if (response.data.websiteStatus == 1)
|
||||
if (response.data.websiteStatus === 1)
|
||||
{
|
||||
if(state=="Suspend"){
|
||||
|
||||
|
|
@ -3071,6 +3068,10 @@ app.controller('launchChild', function($scope,$http) {
|
|||
|
||||
$scope.fileManagerURL = "/filemanager/"+$("#domainNamePage").text();
|
||||
$scope.previewUrl = "/preview/"+$("#childDomain").text()+"/";
|
||||
$scope.wordPressInstallURL = "/websites/" + $("#childDomain").text() + "/wordpressInstall";
|
||||
$scope.joomlaInstallURL = "/websites/" + $("#childDomain").text() + "/joomlaInstall";
|
||||
$scope.setupGit = "/websites/" + $("#childDomain").text() + "/setupGit";
|
||||
$scope.installPrestaURL = "/websites/" + $("#childDomain").text() + "/installPrestaShop";
|
||||
|
||||
var logType = 0;
|
||||
$scope.pageNumber = 1;
|
||||
|
|
@ -3124,7 +3125,7 @@ app.controller('launchChild', function($scope,$http) {
|
|||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if(response.data.logstatus == 1){
|
||||
if(response.data.logstatus === 1){
|
||||
|
||||
|
||||
$scope.logFileLoading = true;
|
||||
|
|
@ -3180,11 +3181,11 @@ app.controller('launchChild', function($scope,$http) {
|
|||
var errorPageNumber = $scope.errorPageNumber;
|
||||
|
||||
|
||||
if(type==3){
|
||||
if(type === 3){
|
||||
errorPageNumber = $scope.errorPageNumber+1;
|
||||
$scope.errorPageNumber = errorPageNumber;
|
||||
}
|
||||
else if(type==4){
|
||||
else if(type === 4){
|
||||
errorPageNumber = $scope.errorPageNumber-1;
|
||||
$scope.errorPageNumber = errorPageNumber;
|
||||
}
|
||||
|
|
@ -3225,7 +3226,7 @@ app.controller('launchChild', function($scope,$http) {
|
|||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if(response.data.logstatus == 1){
|
||||
if(response.data.logstatus === 1){
|
||||
|
||||
|
||||
// notifications
|
||||
|
|
@ -3805,7 +3806,7 @@ app.controller('launchChild', function($scope,$http) {
|
|||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if(response.data.sslStatus == 1){
|
||||
if(response.data.sslStatus === 1){
|
||||
|
||||
$scope.sslSaved = false;
|
||||
$scope.couldNotSaveSSL = true;
|
||||
|
|
@ -3931,7 +3932,7 @@ app.controller('launchChild', function($scope,$http) {
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,72 @@
|
|||
{% extends "baseTemplate/index.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Change User ACL - CyberPanel" %}{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{% load static %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
|
||||
<div class="container">
|
||||
<div id="page-title">
|
||||
<h2>{% trans "Change User ACL" %}</h2>
|
||||
<p>{% trans "This page can be used to change ACL for CyberPanel users." %}</p>
|
||||
</div>
|
||||
|
||||
<div ng-controller="changeUserACLCTRL" class="panel">
|
||||
<div class="panel-body">
|
||||
<h3 class="title-hero">
|
||||
{% trans "Delete Website" %} <img ng-hide="aclLoading" src="{% static 'images/loading.gif' %}">
|
||||
</h3>
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
|
||||
<form action="/" class="form-horizontal bordered-row">
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Select User" %} </label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-model="selectedUser" class="form-control">
|
||||
{% for items in usersList %}
|
||||
<option>{{ items }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Select ACL" %} </label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-model="selectedACL" class="form-control">
|
||||
{% for items in aclNames %}
|
||||
<option>{{ items }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div ng-hide="deleteACLButton" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" ng-click="changeACLFunc()" class="btn btn-primary btn-lg btn-block">{% trans "Change ACL" %}</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
|
@ -0,0 +1,423 @@
|
|||
{% extends "baseTemplate/index.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Create new ACL - CyberPanel" %}{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{% load static %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
|
||||
<div class="container">
|
||||
<div id="page-title">
|
||||
<h2>{% trans "Create New ACL" %}</h2>
|
||||
<p>{% trans "Create new Access Control defination, that specifies what CyberPanel users can do." %}</p>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<div ng-controller="createACLCTRL" class="panel-body">
|
||||
<h3 class="title-hero">
|
||||
{% trans "ACL Details" %}
|
||||
</h3>
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
|
||||
<form name="createUser" action="/" class="form-horizontal bordered-row">
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "ACL Name" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input placeholder="E.g support" type="text" class="form-control" ng-model="aclName" required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-change="adminHook()" ng-model="makeAdmin" type="checkbox" value="">
|
||||
{% trans "Make Admin" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Version Management" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="versionManagement" type="checkbox" value="">
|
||||
{% trans "Version Management" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "User Management" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="createNewUser" type="checkbox" value="">
|
||||
{% trans "Create New User" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="resellerCenter" type="checkbox" value="">
|
||||
{% trans "Reseller Center" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="deleteUser" type="checkbox" value="">
|
||||
{% trans "Delete User" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="changeUserACL" type="checkbox" value="">
|
||||
{% trans "Change User ACL" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Website Management" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="createWebsite" type="checkbox" value="">
|
||||
{% trans "Create Website" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="modifyWebsite" type="checkbox" value="">
|
||||
{% trans "Modify Website" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="suspendWebsite" type="checkbox" value="">
|
||||
{% trans "Suspend Website" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="deleteWebsite" type="checkbox" value="">
|
||||
{% trans "Delete Website" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Package Management" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="createPackage" type="checkbox" value="">
|
||||
{% trans "Create Package" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="deletePackage" type="checkbox" value="">
|
||||
{% trans "Delete Package" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="modifyPackage" type="checkbox" value="">
|
||||
{% trans "Modify Package" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Database Management" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="createDatabase" type="checkbox" value="">
|
||||
{% trans "Create Database" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="deleteDatabase" type="checkbox" value="">
|
||||
{% trans "Delete Database" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="listDatabases" type="checkbox" value="">
|
||||
{% trans "List Databases" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "DNS Management" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="createNameServer" type="checkbox" value="">
|
||||
{% trans "Create Nameserver" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="createDNSZone" type="checkbox" value="">
|
||||
{% trans "Delete DNS Zone" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="deleteZone" type="checkbox" value="">
|
||||
{% trans "Delete Zone" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="addDeleteRecords" type="checkbox" value="">
|
||||
{% trans "Add/Delete" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Email Management" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="createEmail" type="checkbox" value="">
|
||||
{% trans "Create Email" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="deleteEmail" type="checkbox" value="">
|
||||
{% trans "Delete Email" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="emailForwarding" type="checkbox" value="">
|
||||
{% trans "Email Forwarding" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="changeEmailPassword" type="checkbox" value="">
|
||||
{% trans "Change Email Password" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="dkimManager" type="checkbox" value="">
|
||||
{% trans "DKIM Manager" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "FTP Management" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="createFTPAccount" type="checkbox" value="">
|
||||
{% trans "Create FTP Account" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="deleteFTPAccount" type="checkbox" value="">
|
||||
{% trans "Delete FTP Account" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="listFTPAccounts" type="checkbox" value="">
|
||||
{% trans "List FTP Accounts" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Backup Management" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="createBackup" type="checkbox" value="">
|
||||
{% trans "Create Back up" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="restoreBackup" type="checkbox" value="">
|
||||
{% trans "Restore Back up" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="addDeleteDestinations" type="checkbox" value="">
|
||||
{% trans "Add/Delete Destination" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="scheDuleBackups" type="checkbox" value="">
|
||||
{% trans "Achedule Back up" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="remoteBackups" type="checkbox" value="">
|
||||
{% trans "Remote Back ups" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "SSL Management" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="manageSSL" type="checkbox" value="">
|
||||
{% trans "Manage SSL" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="hostnameSSL" type="checkbox" value="">
|
||||
{% trans "Hostname SSL" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="mailServerSSL" type="checkbox" value="">
|
||||
{% trans "MailServer SSL" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" ng-click="createACLFunc()" class="btn btn-primary btn-lg btn-block">{% trans "Create ACL" %} <img ng-hide="aclLoading" src="{% static 'images/loading.gif' %}"></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
|
@ -54,57 +54,34 @@
|
|||
|
||||
|
||||
|
||||
<!------------ Account Type ------------>
|
||||
|
||||
|
||||
{% if adminType == 1 %}
|
||||
|
||||
<!------------ Account ACL ------------>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Account Type" %}</label>
|
||||
<label class="col-sm-3 control-label">{% trans "Select ACL" %} </label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-change="showLimitsBox()" ng-model="accountType" class="form-control">
|
||||
<option>Admin</option>
|
||||
<option>Normal User</option>
|
||||
<select ng-model="selectedACL" class="form-control">
|
||||
{% for items in aclNames %}
|
||||
<option>{{ items }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
<!------------ Account ACL ------------>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Account Type" %}</label>
|
||||
<label class="col-sm-3 control-label">{% trans "Websites Limit" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-change="showLimitsBox()" ng-model="accountType" class="form-control">
|
||||
<option>Normal User</option>
|
||||
</select>
|
||||
<input placeholder="0 = Unlimited" type="number" class="form-control" ng-model="websitesLimits" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
<!------------ Account Type ------------>
|
||||
|
||||
|
||||
<div ng-hide="acctsLimit" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "User Accounts Limit" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input name="userAccountsLimit" type="number" class="form-control" ng-model="userAccountsLimit" required>
|
||||
</div>
|
||||
<div ng-show="createUser.userAccountsLimit.$error.number" class="current-pack">{% trans "Only Numbers" %}</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Username" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input name="username" ng-change="hideSomeThings()" type="text" class="form-control" ng-model="userName" required>
|
||||
<input type="text" class="form-control" ng-model="userName" required>
|
||||
</div>
|
||||
<div ng-show="createUser.username.$error.pattern" class="current-pack">{% trans "Username should be lowercase alphanumeric." %}</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
@ -114,8 +91,6 @@
|
|||
<div class="col-sm-6">
|
||||
<input name="password" type="password" class="form-control" ng-model="password" required>
|
||||
</div>
|
||||
<div ng-show="createUser.password.$error.pattern" class="current-pack">{% trans "Must contain one number and one special character." %}</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
|
@ -123,12 +98,7 @@
|
|||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button ng-disabled="createUser.websitesLimit.$error.number ||
|
||||
createUser.userAccountsLimit.$error.number ||
|
||||
createUser.email.$error.email ||
|
||||
createUser.firstName.$error.pattern ||
|
||||
createUser.lastName.$error.pattern"
|
||||
type="button" ng-click="createUserFunc()" class="btn btn-primary btn-lg btn-block">{% trans "Create User" %}</button>
|
||||
<button type="button" ng-click="createUserFunc()" class="btn btn-primary btn-lg btn-block">{% trans "Create User" %}</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,68 @@
|
|||
{% extends "baseTemplate/index.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Delete ACL - CyberPanel" %}{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{% load static %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
|
||||
<div class="container">
|
||||
<div id="page-title">
|
||||
<h2>{% trans "Delete ACL" %}</h2>
|
||||
<p>{% trans "This page can be used to delete ACL." %}</p>
|
||||
</div>
|
||||
|
||||
<div ng-controller="deleteACTCTRL" class="panel">
|
||||
<div class="panel-body">
|
||||
<h3 class="title-hero">
|
||||
{% trans "Delete Website" %} <img ng-hide="aclLoading" src="{% static 'images/loading.gif' %}">
|
||||
</h3>
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
|
||||
<form action="/" class="form-horizontal bordered-row">
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Select ACL" %} </label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-model="aclToBeDeleted" class="form-control">
|
||||
{% for items in aclNames %}
|
||||
<option>{{ items }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" ng-click="deleteACLFunc()" class="btn btn-primary btn-lg btn-block">{% trans "Delete ACL" %}</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="deleteACLButton" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" ng-click="deleteACLFinal()" class="btn btn-primary btn-lg btn-block">{% trans "Are you sure?" %}</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
|
@ -0,0 +1,428 @@
|
|||
{% extends "baseTemplate/index.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Modify an ACL - CyberPanel" %}{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{% load static %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
|
||||
<div class="container">
|
||||
<div id="page-title">
|
||||
<h2>{% trans "Modify an ACL" %}</h2>
|
||||
<p>{% trans "On this page you can modify an existing ACL." %}</p>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<div ng-controller="modifyACLCtrl" class="panel-body">
|
||||
<h3 class="title-hero">
|
||||
{% trans "ACL Details" %} - <img ng-hide="aclLoading" src="{% static 'images/loading.gif' %}">
|
||||
</h3>
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
|
||||
<form action="/" class="form-horizontal bordered-row">
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Select ACL" %} </label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-change="fetchDetails()" ng-model="aclToModify" class="form-control">
|
||||
{% for items in aclNames %}
|
||||
<option>{{ items }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="aclDetails" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-change="adminHook()" ng-model="makeAdmin" type="checkbox" value="">
|
||||
{% trans "Make Admin" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="aclDetails" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Version Management" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="versionManagement" type="checkbox" value="">
|
||||
{% trans "Version Management" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="aclDetails" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "User Management" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="createNewUser" type="checkbox" value="">
|
||||
{% trans "Create New User" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="resellerCenter" type="checkbox" value="">
|
||||
{% trans "Reseller Center" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="deleteUser" type="checkbox" value="">
|
||||
{% trans "Delete User" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="changeUserACL" type="checkbox" value="">
|
||||
{% trans "Change User ACL" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="aclDetails" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Website Management" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="createWebsite" type="checkbox" value="">
|
||||
{% trans "Create Website" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="modifyWebsite" type="checkbox" value="">
|
||||
{% trans "Modify Website" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="suspendWebsite" type="checkbox" value="">
|
||||
{% trans "Suspend Website" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="deleteWebsite" type="checkbox" value="">
|
||||
{% trans "Delete Website" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div ng-hide="aclDetails" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Package Management" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="createPackage" type="checkbox" value="">
|
||||
{% trans "Create Package" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="deletePackage" type="checkbox" value="">
|
||||
{% trans "Delete Package" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="modifyPackage" type="checkbox" value="">
|
||||
{% trans "Modify Package" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="aclDetails" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Database Management" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="createDatabase" type="checkbox" value="">
|
||||
{% trans "Create Database" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="deleteDatabase" type="checkbox" value="">
|
||||
{% trans "Delete Database" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="listDatabases" type="checkbox" value="">
|
||||
{% trans "List Databases" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="aclDetails" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "DNS Management" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="createNameServer" type="checkbox" value="">
|
||||
{% trans "Create Nameserver" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="createDNSZone" type="checkbox" value="">
|
||||
{% trans "Delete DNS Zone" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="deleteZone" type="checkbox" value="">
|
||||
{% trans "Delete Zone" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="addDeleteRecords" type="checkbox" value="">
|
||||
{% trans "Add/Delete" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div ng-hide="aclDetails" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Email Management" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="createEmail" type="checkbox" value="">
|
||||
{% trans "Create Email" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="deleteEmail" type="checkbox" value="">
|
||||
{% trans "Delete Email" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="emailForwarding" type="checkbox" value="">
|
||||
{% trans "Email Forwarding" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="changeEmailPassword" type="checkbox" value="">
|
||||
{% trans "Change Email Password" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="dkimManager" type="checkbox" value="">
|
||||
{% trans "DKIM Manager" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div ng-hide="aclDetails" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "FTP Management" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="createFTPAccount" type="checkbox" value="">
|
||||
{% trans "Create FTP Account" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="deleteFTPAccount" type="checkbox" value="">
|
||||
{% trans "Delete FTP Account" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="listFTPAccounts" type="checkbox" value="">
|
||||
{% trans "List FTP Accounts" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="aclDetails" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Backup Management" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="createBackup" type="checkbox" value="">
|
||||
{% trans "Create Back up" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="restoreBackup" type="checkbox" value="">
|
||||
{% trans "Restore Back up" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="addDeleteDestinations" type="checkbox" value="">
|
||||
{% trans "Add/Delete Destination" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="scheDuleBackups" type="checkbox" value="">
|
||||
{% trans "Achedule Back up" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="remoteBackups" type="checkbox" value="">
|
||||
{% trans "Remote Back ups" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div ng-hide="aclDetails" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "SSL Management" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="manageSSL" type="checkbox" value="">
|
||||
{% trans "Manage SSL" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="hostnameSSL" type="checkbox" value="">
|
||||
{% trans "Hostname SSL" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="mailServerSSL" type="checkbox" value="">
|
||||
{% trans "MailServer SSL" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="aclDetails" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" ng-click="saveChanges()" class="btn btn-primary btn-lg btn-block">{% trans "Save Changes" %} <img ng-hide="aclLoading" src="{% static 'images/loading.gif' %}"></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
|
@ -22,17 +22,16 @@
|
|||
|
||||
<form action="/" class="form-horizontal bordered-row">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Select Account" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-change="fetchUserDetails()" ng-model="accountUsername" class="form-control">
|
||||
{% for accts in acctNames %}
|
||||
<option>{{ accts }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Select Account" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-change="fetchUserDetails()" ng-model="accountUsername" class="form-control">
|
||||
{% for accts in acctNames %}
|
||||
<option>{{ accts }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="acctDetailsFetched" class="form-group">
|
||||
|
|
@ -58,55 +57,6 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<!------------ Account Type ------------>
|
||||
|
||||
|
||||
{% if adminType == 1 %}
|
||||
|
||||
|
||||
<div ng-hide="accountTypeView" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Account Type" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-change="showLimitsBox()" ng-model="accountType" class="form-control">
|
||||
<option>Admin</option>
|
||||
<option>Normal User</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class="current-pack">{% trans "Currently:" %} {$ currentAccountType $}</div>
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
|
||||
<div ng-hide="accountTypeView" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Account Type" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-change="showLimitsBox()" ng-model="accountType" class="form-control">
|
||||
<option>Normal User</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class="current-pack">{% trans "Currently:" %} {$ currentAccountType $}</div>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
<!------------ Account Type ------------>
|
||||
|
||||
{% if adminType == 1 %}
|
||||
<div ng-hide="userAccountsLimit" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "User Accounts Limit" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" class="form-control" ng-model="userAccountsLimitValue" required>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
<div ng-hide="acctDetailsFetched" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Password" %}</label>
|
||||
<div class="col-sm-6">
|
||||
|
|
@ -116,8 +66,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<div ng-hide="acctDetailsFetched" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,78 @@
|
|||
{% extends "baseTemplate/index.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Reseller Center - CyberPanel" %}{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{% load static %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
|
||||
<div class="container">
|
||||
<div id="page-title">
|
||||
<h2>{% trans "Reseller Center" %}</h2>
|
||||
<p>{% trans "Change owner of users and change websites limits." %}</p>
|
||||
</div>
|
||||
|
||||
<div ng-controller="resellerCenterCTRL" class="panel">
|
||||
<div class="panel-body">
|
||||
<h3 class="title-hero">
|
||||
{% trans "Reseller Center" %} <img ng-hide="aclLoading" src="{% static 'images/loading.gif' %}">
|
||||
</h3>
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
|
||||
<form action="/" class="form-horizontal bordered-row">
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Select User" %} </label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-model="userToBeModified" class="form-control">
|
||||
{% for items in userToBeModified %}
|
||||
<option>{{ items }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "New Owner" %} </label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-model="newOwner" class="form-control">
|
||||
{% for items in resellerPrivUsers %}
|
||||
<option>{{ items }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Websites Limit" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" class="form-control" ng-model="websitesLimit" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" ng-click="saveResellerChanges()" class="btn btn-primary btn-lg btn-block">{% trans "Save Changes" %}</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
|
@ -55,29 +55,12 @@
|
|||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Account Level" %}</label>
|
||||
<label class="col-sm-3 control-label">{% trans "Account ACL" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<div class="current-pack">{{ type }}</div>
|
||||
<div class="current-pack">{{ accountACL }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% if typeNumeric == 1 %}
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "User Accounts Limit" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<div class="current-pack">{{ userAccountsLimit }} {% trans "( 0 = Unlimited )" %}</div>
|
||||
</div>
|
||||
</div>
|
||||
{% elif typeNumeric == 2 %}
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "User Accounts Limit" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<div class="current-pack">{{ userAccountsLimit }} {% trans "( 0 = Unlimited )" %}</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Websites Limit" %}</label>
|
||||
<div class="col-sm-6">
|
||||
|
|
|
|||
|
|
@ -16,4 +16,16 @@ urlpatterns = [
|
|||
|
||||
url(r'^deleteUser',views.deleteUser,name="deleteUser"),
|
||||
url(r'^submitUserDeletion',views.submitUserDeletion,name="submitUserDeletion"),
|
||||
|
||||
url(r'^createNewACL$',views.createNewACL,name="createNewACL"),
|
||||
url(r'^createACLFunc$',views.createACLFunc,name="createACLFunc"),
|
||||
url(r'^deleteACL$',views.deleteACL,name="deleteACL"),
|
||||
url(r'^deleteACLFunc$',views.deleteACLFunc,name="deleteACLFunc"),
|
||||
url(r'^modifyACL$',views.modifyACL,name="modifyACL"),
|
||||
url(r'^fetchACLDetails$',views.fetchACLDetails,name="fetchACLDetails"),
|
||||
url(r'^submitACLModifications$',views.submitACLModifications,name="submitACLModifications"),
|
||||
url(r'^changeUserACL$',views.changeUserACL,name="changeUserACL"),
|
||||
url(r'^changeACLFunc$',views.changeACLFunc,name="changeACLFunc"),
|
||||
url(r'^resellerCenter$',views.resellerCenter,name="resellerCenter"),
|
||||
url(r'^saveResellerChanges$',views.saveResellerChanges,name="saveResellerChanges"),
|
||||
]
|
||||
|
|
@ -4,10 +4,11 @@ from __future__ import unicode_literals
|
|||
from django.shortcuts import render,redirect
|
||||
from django.http import HttpResponse
|
||||
from loginSystem.views import loadLoginPage
|
||||
from loginSystem.models import Administrator
|
||||
from loginSystem.models import Administrator, ACL
|
||||
import json
|
||||
from plogical import hashPassword
|
||||
from plogical import CyberCPLogFileWriter as logging
|
||||
from plogical.acl import ACLManager
|
||||
|
||||
# Create your views here.
|
||||
|
||||
|
|
@ -26,7 +27,6 @@ def loadUserHome(request):
|
|||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def viewProfile(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
|
@ -38,143 +38,119 @@ def viewProfile(request):
|
|||
AdminData['userName'] = admin.userName
|
||||
AdminData['firstName'] = admin.firstName
|
||||
AdminData['lastName'] = admin.lastName
|
||||
AdminData['userAccountsLimit'] = admin.initUserAccountsLimit
|
||||
AdminData['websitesLimit'] = admin.initWebsitesLimit
|
||||
AdminData['email'] = admin.email
|
||||
AdminData['typeNumeric'] = admin.type
|
||||
|
||||
if admin.type == 1:
|
||||
AdminData['type'] = "root"
|
||||
elif admin.type == 2:
|
||||
AdminData['type'] = "Reseller"
|
||||
else:
|
||||
AdminData['type'] = "User"
|
||||
AdminData['accountACL'] = admin.acl.name
|
||||
|
||||
return render(request, 'userManagment/userProfile.html',AdminData)
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def createUser(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
if currentACL['admin'] == 1:
|
||||
aclNames = ACLManager.unFileteredACLs()
|
||||
return render(request, 'userManagment/createUser.html', {'aclNames' : aclNames})
|
||||
elif currentACL['changeUserACL'] == 1:
|
||||
aclNames = ACLManager.unFileteredACLs()
|
||||
return render(request, 'userManagment/createUser.html', {'aclNames': aclNames})
|
||||
elif currentACL['createNewUser'] == 1:
|
||||
aclNames = ['user']
|
||||
return render(request, 'userManagment/createUser.html', {'aclNames': aclNames})
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough privileges to access this page.")
|
||||
|
||||
try:
|
||||
adminType = admin.type
|
||||
|
||||
return render(request, 'userManagment/createUser.html',{"adminType":adminType})
|
||||
|
||||
except BaseException,msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return HttpResponse("Look for errors in CyberCP Main Log File")
|
||||
|
||||
except KeyError:
|
||||
except BaseException,msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def submitUserCreation(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
currentAdmin = Administrator.objects.get(pk=val)
|
||||
data = json.loads(request.body)
|
||||
firstName = data['firstName']
|
||||
lastName = data['lastName']
|
||||
email = data['email']
|
||||
userName = data['userName']
|
||||
password = data['password']
|
||||
websitesLimit = data['websitesLimit']
|
||||
selectedACL = data['selectedACL']
|
||||
|
||||
childUsers = Administrator.objects.filter(owner=currentAdmin.pk).count()
|
||||
|
||||
if currentAdmin.type == 1:
|
||||
pass
|
||||
selectedACL = ACL.objects.get(name=selectedACL)
|
||||
|
||||
if selectedACL.adminStatus == 1:
|
||||
type = 1
|
||||
else:
|
||||
if currentAdmin.initWebsitesLimit == 0:
|
||||
pass
|
||||
type = 3
|
||||
|
||||
elif currentAdmin.initUserAccountsLimit == childUsers:
|
||||
data_ret = {'createStatus': 0,
|
||||
'error_message': "Reached Maximum User Creation Limit"}
|
||||
password = hashPassword.hash_password(password)
|
||||
currentAdmin = Administrator.objects.get(pk=userID)
|
||||
|
||||
final_json = json.dumps(data_ret)
|
||||
return HttpResponse(final_json)
|
||||
else:
|
||||
pass
|
||||
if ACLManager.websitesLimitCheck(currentAdmin, websitesLimit) == 0:
|
||||
data_ret = {'createStatus': 0,
|
||||
'error_message': "You've reached maximum websites limit as a reseller."}
|
||||
|
||||
final_json = json.dumps(data_ret)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
if request.method == 'POST':
|
||||
data = json.loads(request.body)
|
||||
firstName = data['firstName']
|
||||
lastName = data['lastName']
|
||||
email = data['email']
|
||||
userName = data['userName']
|
||||
password = data['password']
|
||||
if currentACL['admin'] == 1:
|
||||
|
||||
password = hashPassword.hash_password(password)
|
||||
newAdmin = Administrator(firstName=firstName,
|
||||
lastName=lastName,
|
||||
email=email,
|
||||
type=type,
|
||||
userName=userName,
|
||||
password=password,
|
||||
initWebsitesLimit=websitesLimit,
|
||||
owner=currentAdmin.pk,
|
||||
acl=selectedACL
|
||||
)
|
||||
newAdmin.save()
|
||||
|
||||
accountType = data['accountType']
|
||||
elif currentACL['changeUserACL'] == 1:
|
||||
|
||||
if accountType == "Admin":
|
||||
newAdmin = Administrator(firstName=firstName,
|
||||
lastName=lastName,
|
||||
email=email,
|
||||
type=type,
|
||||
userName=userName,
|
||||
password=password,
|
||||
initWebsitesLimit=websitesLimit,
|
||||
owner=currentAdmin.pk,
|
||||
acl=selectedACL
|
||||
)
|
||||
newAdmin.save()
|
||||
elif currentACL['createNewUser'] == 1:
|
||||
|
||||
newAdmin = Administrator(firstName=firstName,
|
||||
lastName=lastName,
|
||||
email=email,
|
||||
type=1,
|
||||
userName=userName,
|
||||
password=password,
|
||||
initWebsitesLimit=0,
|
||||
owner=currentAdmin.pk
|
||||
)
|
||||
newAdmin.save()
|
||||
currentAdmin.save()
|
||||
newAdmin = Administrator(firstName=firstName,
|
||||
lastName=lastName,
|
||||
email=email,
|
||||
type=type,
|
||||
userName=userName,
|
||||
password=password,
|
||||
initWebsitesLimit=websitesLimit,
|
||||
owner=currentAdmin.pk,
|
||||
acl=selectedACL
|
||||
)
|
||||
newAdmin.save()
|
||||
else:
|
||||
data_ret = {'createStatus': 0,
|
||||
'error_message': "You are not authorized to access this resource."}
|
||||
|
||||
data_ret = {'createStatus': 1,
|
||||
'error_message': "None"}
|
||||
final_json = json.dumps(data_ret)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
final_json = json.dumps(data_ret)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
elif accountType == "Normal User":
|
||||
|
||||
newAdmin = Administrator(firstName=firstName,
|
||||
lastName=lastName,
|
||||
email=email,
|
||||
type=3,
|
||||
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)
|
||||
else:
|
||||
websitesLimit = data['websitesLimit']
|
||||
userAccountsLimit = 0
|
||||
|
||||
newAdmin = Administrator(firstName=firstName,
|
||||
lastName=lastName,
|
||||
email=email,
|
||||
type=2,
|
||||
userName=userName,
|
||||
password=password,
|
||||
initWebsitesLimit=websitesLimit,
|
||||
initUserAccountsLimit=userAccountsLimit,
|
||||
owner=currentAdmin.pk
|
||||
)
|
||||
newAdmin.save()
|
||||
currentAdmin.save()
|
||||
|
||||
data_ret = {'createStatus': 1,
|
||||
'error_message': "None"}
|
||||
final_json = json.dumps(data_ret)
|
||||
return HttpResponse(final_json)
|
||||
data_ret = {'createStatus': 1,
|
||||
'error_message': "None"}
|
||||
final_json = json.dumps(data_ret)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
data_ret = {'createStatus': 0, 'error_message': str(msg)}
|
||||
|
|
@ -186,29 +162,11 @@ def submitUserCreation(request):
|
|||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def modifyUsers(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
adminNames = []
|
||||
|
||||
if admin.type == 1:
|
||||
admins = Administrator.objects.all()
|
||||
adminType = 1
|
||||
for items in admins:
|
||||
adminNames.append(items.userName)
|
||||
elif admin.type == 2:
|
||||
admins = Administrator.objects.filter(owner=admin.pk)
|
||||
adminType = 2
|
||||
for items in admins:
|
||||
adminNames.append(items.userName)
|
||||
else:
|
||||
adminType = 3
|
||||
adminNames.append(admin.userName)
|
||||
|
||||
return render(request, 'userManagment/modifyUser.html',{"acctNames":adminNames,"adminType":adminType})
|
||||
adminNames = ACLManager.loadAllUsers(userID)
|
||||
return render(request, 'userManagment/modifyUser.html',{"acctNames":adminNames})
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
|
@ -216,9 +174,6 @@ def fetchUserDetails(request):
|
|||
try:
|
||||
val = request.session['userID']
|
||||
try:
|
||||
|
||||
currentAdmin = Administrator.objects.get(pk=val)
|
||||
|
||||
if request.method == 'POST':
|
||||
data = json.loads(request.body)
|
||||
accountUsername = data['accountUsername']
|
||||
|
|
@ -229,22 +184,12 @@ def fetchUserDetails(request):
|
|||
lastName = user.lastName
|
||||
email = user.email
|
||||
|
||||
if user.type == 1:
|
||||
accountType = "Administrator"
|
||||
elif user.type == 2:
|
||||
accountType = "Reseller"
|
||||
else:
|
||||
accountType = "Normal User"
|
||||
|
||||
|
||||
userAccountsLimit = user.initUserAccountsLimit
|
||||
websitesLimit = user.initWebsitesLimit
|
||||
|
||||
userDetails = {"firstName":firstName,
|
||||
"lastName": lastName,
|
||||
"email": email,
|
||||
"accountType": accountType,
|
||||
"userAccountsLimit": userAccountsLimit,
|
||||
"acl": user.acl.name,
|
||||
"websitesLimit": websitesLimit}
|
||||
|
||||
data_ret = {'fetchStatus': 1, 'error_message': 'None',"userDetails":userDetails}
|
||||
|
|
@ -252,7 +197,6 @@ def fetchUserDetails(request):
|
|||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
data_ret = {'fetchStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
|
|
@ -263,12 +207,10 @@ def fetchUserDetails(request):
|
|||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def saveModifications(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
try:
|
||||
|
||||
if request.method == 'POST':
|
||||
data = json.loads(request.body)
|
||||
accountUsername = data['accountUsername']
|
||||
|
|
@ -281,77 +223,18 @@ def saveModifications(request):
|
|||
|
||||
password = hashPassword.hash_password(data['password'])
|
||||
|
||||
if admin.type != 1:
|
||||
if admin != user:
|
||||
data_ret = {'saveStatus': 1, 'error_message': 'Not enough privileges'}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
user.firstName = firstName
|
||||
user.lastName = lastName
|
||||
user.email = email
|
||||
user.password = password
|
||||
user.type = 0
|
||||
|
||||
|
||||
if user.type == 1:
|
||||
userAccountsLimit = 0
|
||||
websitesLimit = 0
|
||||
|
||||
user.firstName = firstName
|
||||
user.lastName = lastName
|
||||
user.email = email
|
||||
user.password = password
|
||||
user.initWebsitesLimit = websitesLimit
|
||||
user.initUserAccountsLimit = userAccountsLimit
|
||||
user.type = 1
|
||||
|
||||
user.save()
|
||||
|
||||
data_ret = {'saveStatus': 1, 'error_message': 'None'}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
|
||||
if data['accountType'] == "Reseller":
|
||||
userAccountsLimit = 0
|
||||
websitesLimit = 0
|
||||
|
||||
user.firstName = firstName
|
||||
user.lastName = lastName
|
||||
user.email = email
|
||||
user.password = password
|
||||
user.initWebsitesLimit = websitesLimit
|
||||
user.initUserAccountsLimit = userAccountsLimit
|
||||
user.type = 2
|
||||
|
||||
user.save()
|
||||
|
||||
elif data['accountType'] == "Normal User":
|
||||
|
||||
user.firstName = firstName
|
||||
user.lastName = lastName
|
||||
user.email = email
|
||||
user.password = password
|
||||
user.initWebsitesLimit = 0
|
||||
user.type = 3
|
||||
|
||||
user.save()
|
||||
else:
|
||||
userAccountsLimit = 0
|
||||
websitesLimit = 0
|
||||
|
||||
user.firstName = firstName
|
||||
user.lastName = lastName
|
||||
user.email = email
|
||||
user.password = password
|
||||
user.initWebsitesLimit = websitesLimit
|
||||
user.initUserAccountsLimit = userAccountsLimit
|
||||
user.type = 1
|
||||
|
||||
user.save()
|
||||
user.save()
|
||||
|
||||
data_ret = {'saveStatus': 1, 'error_message': 'None'}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
data_ret = {'saveStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
|
|
@ -362,44 +245,37 @@ def saveModifications(request):
|
|||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def deleteUser(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough privileges to access this page.")
|
||||
|
||||
if admin.type == 1:
|
||||
admins = Administrator.objects.all()
|
||||
adminNames = []
|
||||
for items in admins:
|
||||
if not items.userName == "admin":
|
||||
adminNames.append(items.userName)
|
||||
if currentACL['admin'] == 1:
|
||||
adminNames = ACLManager.loadDeletionUsers(userID, currentACL)
|
||||
return render(request, 'userManagment/deleteUser.html', {"acctNames": adminNames})
|
||||
elif currentACL['deleteUser'] == 1:
|
||||
adminNames = ACLManager.loadDeletionUsers(userID, currentACL)
|
||||
return render(request, 'userManagment/deleteUser.html', {"acctNames": adminNames})
|
||||
else:
|
||||
admins = Administrator.objects.filter(owner=admin.pk)
|
||||
adminNames = []
|
||||
for items in admins:
|
||||
adminNames.append(items.userName)
|
||||
return ACLManager.loadError()
|
||||
|
||||
|
||||
return render(request, 'userManagment/deleteUser.html',{"acctNames":adminNames})
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def submitUserDeletion(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
try:
|
||||
|
||||
if request.method == 'POST':
|
||||
data = json.loads(request.body)
|
||||
accountUsername = data['accountUsername']
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if admin.type == 1:
|
||||
if currentACL['admin'] == 1:
|
||||
user = Administrator.objects.get(userName=accountUsername)
|
||||
user.delete()
|
||||
|
||||
|
|
@ -422,3 +298,438 @@ def submitUserDeletion(request):
|
|||
data_ret = {'deleteStatus': 0, 'error_message': "Not logged in as admin",}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
def createNewACL(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
return render(request, 'userManagment/createACL.html')
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def createACLFunc(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
|
||||
currentACL = ACLManager.loadedACL(val)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
data = json.loads(request.body)
|
||||
|
||||
## Version Management
|
||||
|
||||
newACL = ACL(name=data['aclName'],
|
||||
adminStatus = int(data['makeAdmin']),
|
||||
|
||||
versionManagement=int(data['versionManagement']),
|
||||
|
||||
## User Management
|
||||
createNewUser = int(data['createNewUser']),
|
||||
resellerCenter = int(data['resellerCenter']),
|
||||
deleteUser = int(data['deleteUser']),
|
||||
changeUserACL= int(data['changeUserACL']),
|
||||
|
||||
## Website Management
|
||||
|
||||
createWebsite = int(data['createWebsite']),
|
||||
modifyWebsite = int(data['modifyWebsite']),
|
||||
suspendWebsite = int(data['suspendWebsite']),
|
||||
deleteWebsite = int(data['deleteWebsite']),
|
||||
|
||||
## Package Management
|
||||
|
||||
createPackage = int(data['createPackage']),
|
||||
deletePackage = int(data['deletePackage']),
|
||||
modifyPackage = int(data['modifyPackage']),
|
||||
|
||||
## Database Management
|
||||
|
||||
createDatabase = int(data['createDatabase']),
|
||||
deleteDatabase = int(data['deleteDatabase']),
|
||||
listDatabases = int(data['listDatabases']),
|
||||
|
||||
## DNS Management
|
||||
|
||||
createNameServer = int(data['createNameServer']),
|
||||
createDNSZone = int(data['createDNSZone']),
|
||||
deleteZone = int(data['deleteZone']),
|
||||
addDeleteRecords = int(data['addDeleteRecords']),
|
||||
|
||||
## Email Management
|
||||
|
||||
createEmail = int(data['createEmail']),
|
||||
deleteEmail = int(data['deleteEmail']),
|
||||
emailForwarding = int(data['emailForwarding']),
|
||||
changeEmailPassword = int(data['changeEmailPassword']),
|
||||
dkimManager = int(data['dkimManager']),
|
||||
|
||||
## FTP Management
|
||||
|
||||
createFTPAccount = int(data['createFTPAccount']),
|
||||
deleteFTPAccount = int(data['deleteFTPAccount']),
|
||||
listFTPAccounts = int(data['listFTPAccounts']),
|
||||
|
||||
## Backup Management
|
||||
|
||||
createBackup = int(data['createBackup']),
|
||||
restoreBackup = int(data['restoreBackup']),
|
||||
addDeleteDestinations = int(data['addDeleteDestinations']),
|
||||
scheDuleBackups = int(data['scheDuleBackups']),
|
||||
remoteBackups = int(data['remoteBackups']),
|
||||
|
||||
## SSL Management
|
||||
|
||||
manageSSL = int(data['manageSSL']),
|
||||
hostnameSSL = int(data['hostnameSSL']),
|
||||
mailServerSSL = int(data['mailServerSSL']),
|
||||
)
|
||||
newACL.save()
|
||||
|
||||
|
||||
|
||||
finalResponse = { 'status': 1}
|
||||
else:
|
||||
finalResponse = ACLManager.loadErrorJson()
|
||||
|
||||
json_data = json.dumps(finalResponse)
|
||||
return HttpResponse(json_data)
|
||||
except BaseException, msg:
|
||||
finalResponse = {'status':0, 'errorMessage': str(msg)}
|
||||
json_data = json.dumps(finalResponse)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
def deleteACL(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
aclNames = ACLManager.findAllACLs()
|
||||
return render(request, 'userManagment/deleteACL.html', {'aclNames' : aclNames})
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def deleteACLFunc(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
|
||||
currentACL = ACLManager.loadedACL(val)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
data = json.loads(request.body)
|
||||
acl = ACL.objects.get(name=data['aclToBeDeleted'])
|
||||
|
||||
if acl.administrator_set.all().count() == 0:
|
||||
acl.delete()
|
||||
finalResponse = {'status': 1}
|
||||
else:
|
||||
finalResponse = {'status': 0, 'errorMesssage' : 'This ACL is currently in used by existing users.'}
|
||||
else:
|
||||
finalResponse = ACLManager.loadErrorJson()
|
||||
|
||||
json_data = json.dumps(finalResponse)
|
||||
return HttpResponse(json_data)
|
||||
except BaseException, msg:
|
||||
finalResponse = {'status':0, 'errorMessage': str(msg)}
|
||||
json_data = json.dumps(finalResponse)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
def modifyACL(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
aclNames = ACLManager.findAllACLs()
|
||||
return render(request, 'userManagment/modifyACL.html', {'aclNames' : aclNames})
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def fetchACLDetails(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
|
||||
currentACL = ACLManager.loadedACL(val)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
data = json.loads(request.body)
|
||||
|
||||
## Version Management
|
||||
finalResponse = {}
|
||||
|
||||
acl = ACL.objects.get(name=data['aclToModify'])
|
||||
finalResponse['versionManagement'] = acl.versionManagement
|
||||
finalResponse['adminStatus'] = acl.adminStatus
|
||||
|
||||
## User Management
|
||||
|
||||
finalResponse['createNewUser'] = acl.createNewUser
|
||||
finalResponse['resellerCenter'] = acl.resellerCenter
|
||||
finalResponse['deleteUser'] = acl.deleteUser
|
||||
finalResponse['changeUserACL'] = acl.changeUserACL
|
||||
|
||||
## Website Management
|
||||
|
||||
finalResponse['createWebsite'] = acl.createWebsite
|
||||
finalResponse['modifyWebsite'] = acl.modifyWebsite
|
||||
finalResponse['suspendWebsite'] = acl.suspendWebsite
|
||||
finalResponse['deleteWebsite'] = acl.deleteWebsite
|
||||
|
||||
## Package Management
|
||||
|
||||
|
||||
finalResponse['createPackage'] = acl.createPackage
|
||||
finalResponse['deletePackage'] = acl.deletePackage
|
||||
finalResponse['modifyPackage'] = acl.modifyPackage
|
||||
|
||||
## Database Management
|
||||
|
||||
finalResponse['createDatabase'] = acl.createDatabase
|
||||
finalResponse['deleteDatabase'] = acl.deleteDatabase
|
||||
finalResponse['listDatabases'] = acl.listDatabases
|
||||
|
||||
## DNS Management
|
||||
|
||||
finalResponse['createNameServer'] = acl.createNameServer
|
||||
finalResponse['createDNSZone'] = acl.createDNSZone
|
||||
finalResponse['deleteZone'] = acl.deleteZone
|
||||
finalResponse['addDeleteRecords'] = acl.addDeleteRecords
|
||||
|
||||
## Email Management
|
||||
|
||||
finalResponse['createEmail'] = acl.createEmail
|
||||
finalResponse['deleteEmail'] = acl.deleteEmail
|
||||
finalResponse['emailForwarding'] = acl.emailForwarding
|
||||
finalResponse['changeEmailPassword'] = acl.changeEmailPassword
|
||||
finalResponse['dkimManager'] = acl.dkimManager
|
||||
|
||||
## FTP Management
|
||||
|
||||
finalResponse['createFTPAccount'] = acl.createFTPAccount
|
||||
finalResponse['deleteFTPAccount'] = acl.deleteFTPAccount
|
||||
finalResponse['listFTPAccounts'] = acl.listFTPAccounts
|
||||
|
||||
|
||||
## Backup Management
|
||||
|
||||
finalResponse['createBackup'] = acl.createBackup
|
||||
finalResponse['restoreBackup'] = acl.restoreBackup
|
||||
finalResponse['addDeleteDestinations'] = acl.addDeleteDestinations
|
||||
finalResponse['scheDuleBackups'] = acl.scheDuleBackups
|
||||
finalResponse['remoteBackups'] = acl.remoteBackups
|
||||
|
||||
|
||||
## SSL Management
|
||||
|
||||
finalResponse['manageSSL'] = acl.manageSSL
|
||||
finalResponse['hostnameSSL'] = acl.hostnameSSL
|
||||
finalResponse['mailServerSSL'] = acl.mailServerSSL
|
||||
|
||||
finalResponse['status'] = 1
|
||||
else:
|
||||
finalResponse = ACLManager.loadErrorJson()
|
||||
|
||||
json_data = json.dumps(finalResponse)
|
||||
return HttpResponse(json_data)
|
||||
except BaseException, msg:
|
||||
finalResponse = {'status': 0, 'errorMessage': str(msg)}
|
||||
json_data = json.dumps(finalResponse)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
def submitACLModifications(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
|
||||
currentACL = ACLManager.loadedACL(val)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
data = json.loads(request.body)
|
||||
|
||||
## Version Management
|
||||
|
||||
acl = ACL.objects.get(name=data['aclToModify'])
|
||||
acl.adminStatus = int(data['adminStatus'])
|
||||
acl.versionManagement = int(data['versionManagement'])
|
||||
|
||||
## User Management
|
||||
|
||||
acl.createNewUser = int(data['createNewUser'])
|
||||
acl.resellerCenter = int(data['resellerCenter'])
|
||||
acl.deleteUser = int(data['deleteUser'])
|
||||
acl.changeUserACL = int(data['changeUserACL'])
|
||||
|
||||
## Website Management
|
||||
|
||||
acl.createWebsite = int(data['createWebsite'])
|
||||
acl.modifyWebsite = int(data['modifyWebsite'])
|
||||
acl.suspendWebsite = int(data['suspendWebsite'])
|
||||
acl.deleteWebsite = int(data['deleteWebsite'])
|
||||
|
||||
## Package Management
|
||||
|
||||
acl.createPackage = int(data['createPackage'])
|
||||
acl.deletePackage = int(data['deletePackage'])
|
||||
acl.modifyPackage = int(data['modifyPackage'])
|
||||
|
||||
## Database Management
|
||||
|
||||
acl.createDatabase = int(data['createDatabase'])
|
||||
acl.deleteDatabase = int(data['deleteDatabase'])
|
||||
acl.listDatabases = int(data['listDatabases'])
|
||||
|
||||
## DNS Management
|
||||
|
||||
acl.createNameServer = int(data['createNameServer'])
|
||||
acl.createDNSZone = int(data['createDNSZone'])
|
||||
acl.deleteZone = int(data['deleteZone'])
|
||||
acl.addDeleteRecords = int(data['addDeleteRecords'])
|
||||
|
||||
## Email Management
|
||||
|
||||
acl.createEmail = int(data['createEmail'])
|
||||
acl.deleteEmail = int(data['deleteEmail'])
|
||||
acl.emailForwarding = int(data['emailForwarding'])
|
||||
acl.changeEmailPassword = int(data['changeEmailPassword'])
|
||||
acl.dkimManager = int(data['dkimManager'])
|
||||
|
||||
## FTP Management
|
||||
|
||||
acl.createFTPAccount = int(data['createFTPAccount'])
|
||||
acl.deleteFTPAccount = int(data['deleteFTPAccount'])
|
||||
acl.listFTPAccounts = int(data['listFTPAccounts'])
|
||||
|
||||
## Backup Management
|
||||
|
||||
acl.createBackup = int(data['createBackup'])
|
||||
acl.restoreBackup = int(data['restoreBackup'])
|
||||
acl.addDeleteDestinations = int(data['addDeleteDestinations'])
|
||||
acl.scheDuleBackups = int(data['scheDuleBackups'])
|
||||
acl.remoteBackups = int(data['remoteBackups'])
|
||||
|
||||
## SSL Management
|
||||
|
||||
acl.manageSSL = int(data['manageSSL'])
|
||||
acl.hostnameSSL = int(data['hostnameSSL'])
|
||||
acl.mailServerSSL = int(data['mailServerSSL'])
|
||||
|
||||
acl.save()
|
||||
|
||||
finalResponse = { 'status': 1}
|
||||
else:
|
||||
finalResponse = ACLManager.loadErrorJson()
|
||||
|
||||
json_data = json.dumps(finalResponse)
|
||||
return HttpResponse(json_data)
|
||||
except BaseException, msg:
|
||||
finalResponse = {'status':0, 'errorMessage': str(msg)}
|
||||
json_data = json.dumps(finalResponse)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
def changeUserACL(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
aclNames = ACLManager.unFileteredACLs()
|
||||
userNames = ACLManager.findAllUsers()
|
||||
return render(request, 'userManagment/changeUserACL.html', {'aclNames' : aclNames, 'usersList': userNames})
|
||||
elif currentACL['changeUserACL'] == 1:
|
||||
aclNames = ACLManager.unFileteredACLs()
|
||||
userNames = ACLManager.findAllUsers()
|
||||
|
||||
return render(request, 'userManagment/changeUserACL.html', {'aclNames': aclNames, 'usersList': userNames})
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def changeACLFunc(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
|
||||
currentACL = ACLManager.loadedACL(val)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
data = json.loads(request.body)
|
||||
selectedACL = ACL.objects.get(name=data['selectedACL'])
|
||||
selectedUser = Administrator.objects.get(userName=data['selectedUser'])
|
||||
|
||||
selectedUser.acl = selectedACL
|
||||
selectedUser.save()
|
||||
|
||||
finalResponse = {'status': 1}
|
||||
elif currentACL['changeUserACL'] == 1:
|
||||
data = json.loads(request.body)
|
||||
selectedACL = ACL.objects.get(name=data['selectedACL'])
|
||||
selectedUser = Administrator.objects.get(userName=data['selectedUser'])
|
||||
|
||||
selectedUser.acl = selectedACL
|
||||
selectedUser.save()
|
||||
|
||||
finalResponse = {'status': 1}
|
||||
else:
|
||||
finalResponse = ACLManager.loadErrorJson()
|
||||
|
||||
json_data = json.dumps(finalResponse)
|
||||
return HttpResponse(json_data)
|
||||
except BaseException, msg:
|
||||
finalResponse = {'status':0, 'errorMessage': str(msg)}
|
||||
json_data = json.dumps(finalResponse)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
def resellerCenter(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
userNames = ACLManager.loadDeletionUsers(userID, currentACL)
|
||||
resellerPrivUsers = ACLManager.userWithResellerPriv(userID)
|
||||
return render(request, 'userManagment/resellerCenter.html', {'userToBeModified': userNames, 'resellerPrivUsers': resellerPrivUsers})
|
||||
elif currentACL['resellerCenter'] == 1:
|
||||
userNames = ACLManager.loadDeletionUsers(userID, currentACL)
|
||||
resellerPrivUsers = ACLManager.userWithResellerPriv(userID)
|
||||
return render(request, 'userManagment/resellerCenter.html',{'userToBeModified': userNames, 'resellerPrivUsers': resellerPrivUsers})
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def saveResellerChanges(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
data = json.loads(request.body)
|
||||
|
||||
userToBeModified = Administrator.objects.get(userName=data['userToBeModified'])
|
||||
newOwner = Administrator.objects.get(userName=data['newOwner'])
|
||||
|
||||
if ACLManager.websitesLimitCheck(newOwner, data['websitesLimit'], userToBeModified) == 0:
|
||||
finalResponse = {'status': 0,
|
||||
'errorMessage': "You've reached maximum websites limit as a reseller."}
|
||||
json_data = json.dumps(finalResponse)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
userToBeModified.owner = newOwner.pk
|
||||
userToBeModified.initWebsitesLimit = data['websitesLimit']
|
||||
userToBeModified.save()
|
||||
|
||||
finalResponse = {'status': 1}
|
||||
json_data = json.dumps(finalResponse)
|
||||
return HttpResponse(json_data)
|
||||
except BaseException, msg:
|
||||
finalResponse = {'status':0, 'errorMessage': str(msg)}
|
||||
json_data = json.dumps(finalResponse)
|
||||
return HttpResponse(json_data)
|
||||
|
|
@ -42,3 +42,8 @@ class backupSchedules(models.Model):
|
|||
dest = models.ForeignKey(dest)
|
||||
frequency = models.CharField(max_length=15)
|
||||
|
||||
|
||||
class aliasDomains(models.Model):
|
||||
master = models.ForeignKey(Websites, on_delete=models.CASCADE)
|
||||
aliasDomain = models.CharField(max_length=75)
|
||||
|
||||
|
|
|
|||
|
|
@ -537,8 +537,6 @@ app.controller('modifyWebsitesController', function($scope,$http) {
|
|||
|
||||
});
|
||||
|
||||
|
||||
|
||||
/* Java script code to Modify Pacakge ends here */
|
||||
|
||||
|
||||
|
|
@ -723,7 +721,7 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) {
|
|||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if(response.data.logstatus == 1){
|
||||
if(response.data.logstatus === 1){
|
||||
|
||||
|
||||
// notifications
|
||||
|
|
@ -839,7 +837,7 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) {
|
|||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if(response.data.configstatus == 1){
|
||||
if(response.data.configstatus === 1){
|
||||
|
||||
//Rewrite rules
|
||||
|
||||
|
|
@ -956,7 +954,7 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) {
|
|||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if(response.data.configstatus == 1){
|
||||
if(response.data.configstatus === 1){
|
||||
|
||||
$scope.configurationsBox = false;
|
||||
$scope.configsFetched = true;
|
||||
|
|
@ -1366,10 +1364,10 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) {
|
|||
|
||||
var domain = $("#domainNamePage").text();
|
||||
var path = $scope.installPath;
|
||||
var sitename = $scope.sitename
|
||||
var username = $scope.username
|
||||
var password = $scope.password
|
||||
var prefix = $scope.prefix
|
||||
var sitename = $scope.sitename;
|
||||
var username = $scope.username;
|
||||
var password = $scope.password;
|
||||
var prefix = $scope.prefix;
|
||||
|
||||
|
||||
url = "/websites/installJoomla";
|
||||
|
|
@ -1480,7 +1478,7 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) {
|
|||
var data = {
|
||||
virtualHost: virtualHost,
|
||||
cert:cert,
|
||||
key:key,
|
||||
key:key
|
||||
};
|
||||
|
||||
var config = {
|
||||
|
|
@ -2377,9 +2375,8 @@ app.controller('suspendWebsiteControl', function($scope,$http) {
|
|||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
console.log(response.data)
|
||||
|
||||
if (response.data.websiteStatus == 1)
|
||||
if (response.data.websiteStatus === 1)
|
||||
{
|
||||
if(state=="Suspend"){
|
||||
|
||||
|
|
@ -3071,6 +3068,10 @@ app.controller('launchChild', function($scope,$http) {
|
|||
|
||||
$scope.fileManagerURL = "/filemanager/"+$("#domainNamePage").text();
|
||||
$scope.previewUrl = "/preview/"+$("#childDomain").text()+"/";
|
||||
$scope.wordPressInstallURL = "/websites/" + $("#childDomain").text() + "/wordpressInstall";
|
||||
$scope.joomlaInstallURL = "/websites/" + $("#childDomain").text() + "/joomlaInstall";
|
||||
$scope.setupGit = "/websites/" + $("#childDomain").text() + "/setupGit";
|
||||
$scope.installPrestaURL = "/websites/" + $("#childDomain").text() + "/installPrestaShop";
|
||||
|
||||
var logType = 0;
|
||||
$scope.pageNumber = 1;
|
||||
|
|
@ -3124,7 +3125,7 @@ app.controller('launchChild', function($scope,$http) {
|
|||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if(response.data.logstatus == 1){
|
||||
if(response.data.logstatus === 1){
|
||||
|
||||
|
||||
$scope.logFileLoading = true;
|
||||
|
|
@ -3180,11 +3181,11 @@ app.controller('launchChild', function($scope,$http) {
|
|||
var errorPageNumber = $scope.errorPageNumber;
|
||||
|
||||
|
||||
if(type==3){
|
||||
if(type === 3){
|
||||
errorPageNumber = $scope.errorPageNumber+1;
|
||||
$scope.errorPageNumber = errorPageNumber;
|
||||
}
|
||||
else if(type==4){
|
||||
else if(type === 4){
|
||||
errorPageNumber = $scope.errorPageNumber-1;
|
||||
$scope.errorPageNumber = errorPageNumber;
|
||||
}
|
||||
|
|
@ -3225,7 +3226,7 @@ app.controller('launchChild', function($scope,$http) {
|
|||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if(response.data.logstatus == 1){
|
||||
if(response.data.logstatus === 1){
|
||||
|
||||
|
||||
// notifications
|
||||
|
|
@ -3805,7 +3806,7 @@ app.controller('launchChild', function($scope,$http) {
|
|||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if(response.data.sslStatus == 1){
|
||||
if(response.data.sslStatus === 1){
|
||||
|
||||
$scope.sslSaved = false;
|
||||
$scope.couldNotSaveSSL = true;
|
||||
|
|
@ -3931,7 +3932,7 @@ app.controller('launchChild', function($scope,$http) {
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -532,7 +532,6 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
<div style="border-radius: 25px;border-color:#3498db" class="content-box">
|
||||
<h3 class="content-box-header bg-blue">
|
||||
|
|
@ -653,6 +652,72 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
<div style="border-radius: 25px;border-color:#3498db" class="content-box">
|
||||
<h3 class="content-box-header bg-blue">
|
||||
{% trans "Application Installer" %}
|
||||
</h3>
|
||||
|
||||
<div class="content-box-wrapper">
|
||||
<div class="row">
|
||||
|
||||
|
||||
<div class="col-md-4" style="margin-bottom: 2%;">
|
||||
|
||||
<a href="{$ wordPressInstallURL $}" target="_blank" title="{% trans 'Install wordpress with LSCache' %}">
|
||||
<img src="{% static 'images/icons/wordpress.png' %}">
|
||||
</a>
|
||||
<a href="{$ wordPressInstallURL $}" target="_blank" title="{% trans 'Install wordpress with LSCache' %}">
|
||||
<span style='font-size: 21px;font-family: "Times New Roman", Times, serif; padding-left: 2%'>{% trans "Wordpress with LSCache" %}</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4" style="margin-bottom: 2%;">
|
||||
|
||||
<a href="{$ joomlaInstallURL $}" target="_blank" title="{% trans 'Install Joomla with LSCache' %}">
|
||||
<img src="{% static 'images/icons/joomla-logo.png' %}">
|
||||
</a>
|
||||
<a href="{$ joomlaInstallURL $}" target="_blank" title="{% trans 'Install Joomla with LSCache' %}">
|
||||
<span style='font-size: 21px;font-family: "Times New Roman", Times, serif; padding-left: 2%'>{% trans "Joomla" %}</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4" style="margin-bottom: 2%;">
|
||||
|
||||
<a href="{$ setupGit $}" target="_blank" title="{% trans 'Attach Git with this website!' %}">
|
||||
<img src="{% static 'images/icons/git-logo.png' %}">
|
||||
</a>
|
||||
<a href="{$ setupGit $}" target="_blank" title="{% trans 'Attach Git with this website!' %}">
|
||||
<span style='font-size: 21px;font-family: "Times New Roman", Times, serif; padding-left: 2%'>{% trans "Git" %}</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="col-md-4" style="margin-bottom: 2%;">
|
||||
|
||||
<a href="{$ installPrestaURL $}" target="_blank" title="{% trans 'Install Prestashop' %}">
|
||||
<img src="{% static 'images/icons/prestashop.png' %}">
|
||||
</a>
|
||||
<a href="{$ installPrestaURL $}" target="_blank" title="{% trans 'Install Prestashop' %}">
|
||||
<span style='font-size: 21px;font-family: "Times New Roman", Times, serif; padding-left: 2%'>{% trans "Prestashop" %}</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
|
||||
<div class="alert alert-danger">
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue