design overall

This commit is contained in:
usmannasir
2025-06-15 01:10:08 +05:00
parent 03e8bbbf54
commit f23b57053c
2075 changed files with 102714 additions and 25096 deletions

77
filemanager/views.py Executable file → Normal file
View File

@@ -12,20 +12,91 @@ from .filemanager import FileManager as FM
def loadFileManagerHome(request,domain):
try:
# Check if user is logged in
if 'userID' not in request.session:
# Not logged in, redirect to login page
from loginSystem.views import loadLoginPage
return loadLoginPage(request)
userID = request.session['userID']
if Websites.objects.filter(domain=domain).exists():
admin = Administrator.objects.get(pk=userID)
currentACL = ACLManager.loadedACL(userID)
if ACLManager.checkOwnership(domain, admin, currentACL) == 1:
return render(request, 'filemanager/index.html', {'domainName': domain})
# Get IP address for base template context
ipAddress = ACLManager.fetchIP()
# Prepare context for base template
from plogical.acl import ACLManager as ACL
context = {
'domainName': domain,
'ipAddress': ipAddress,
'admin': currentACL.get('admin', 0),
'createNewUser': currentACL.get('createNewUser', 0),
'listUsers': currentACL.get('listUsers', 0),
'resellerCenter': currentACL.get('resellerCenter', 0),
'createWebsite': currentACL.get('createWebsite', 0),
'modifyWebsite': currentACL.get('modifyWebsite', 0),
'suspendWebsite': currentACL.get('suspendWebsite', 0),
'deleteWebsite': currentACL.get('deleteWebsite', 0),
'createPackage': currentACL.get('createPackage', 0),
'listPackages': currentACL.get('listPackages', 0),
'deletePackage': currentACL.get('deletePackage', 0),
'modifyPackage': currentACL.get('modifyPackage', 0),
'createDatabase': currentACL.get('createDatabase', 0),
'deleteDatabase': currentACL.get('deleteDatabase', 0),
'listDatabases': currentACL.get('listDatabases', 0),
'createNameServer': currentACL.get('createNameServer', 0),
'createDNSZone': currentACL.get('createDNSZone', 0),
'deleteZone': currentACL.get('deleteZone', 0),
'addDeleteRecords': currentACL.get('addDeleteRecords', 0),
'createEmail': currentACL.get('createEmail', 0),
'listEmails': currentACL.get('listEmails', 0),
'deleteEmail': currentACL.get('deleteEmail', 0),
'emailForwarding': currentACL.get('emailForwarding', 0),
'changeEmailPassword': currentACL.get('changeEmailPassword', 0),
'dkimManager': currentACL.get('dkimManager', 0),
'createFTPAccount': currentACL.get('createFTPAccount', 0),
'deleteFTPAccount': currentACL.get('deleteFTPAccount', 0),
'listFTPAccounts': currentACL.get('listFTPAccounts', 0),
'createBackup': currentACL.get('createBackup', 0),
'restoreBackup': currentACL.get('restoreBackup', 0),
'addDeleteDestinations': currentACL.get('addDeleteDestinations', 0),
'scheduleBackups': currentACL.get('scheduleBackups', 0),
'googleDriveBackups': currentACL.get('googleDriveBackups', 0),
'remoteBackups': currentACL.get('remoteBackups', 0),
'manageSSL': currentACL.get('manageSSL', 0),
'hostnameSSL': currentACL.get('hostnameSSL', 0),
'mailServerSSL': currentACL.get('mailServerSSL', 0)
}
# Check for server type for context
from plogical.processUtilities import ProcessUtilities
if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
context['serverCheck'] = 0
else:
context['serverCheck'] = 1
# Check if we should use integrated template
# For now, use standard template by default, but allow override
template = 'filemanager/index.html'
if request.GET.get('integrated', '0') == '1':
template = 'filemanager/indexIntegrated.html'
elif request.GET.get('modern', '0') == '1':
template = 'filemanager/indexModern.html'
return render(request, template, context)
else:
return ACLManager.loadError()
else:
return HttpResponse("Domain does not exists.")
except KeyError:
return redirect(loadLoginPage)
except Exception as e:
logging.CyberCPLogFileWriter.writeToFile(f"File Manager Error: {str(e)}")
from loginSystem.views import loadLoginPage
return loadLoginPage(request)
def changePermissions(request):
try: