Merge branch 'stable' into qtwrkdev

This commit is contained in:
qtwrk
2020-01-20 15:56:42 +01:00
8 changed files with 56 additions and 17 deletions

View File

@@ -1282,6 +1282,37 @@ def main():
cyberpanel.issueSelfSignedSSL(args.domainName)
elif args.function == 'utility':
if not os.path.exists('/usr/bin/cyberpanel_utility'):
command = 'wget -q -O /usr/bin/cyberpanel_utility https://cyberpanel.sh/misc/cyberpanel_utility.sh'
ProcessUtilities.executioner(command)
command = 'chmod 700 /usr/bin/cyberpanel_utility'
ProcessUtilities.executioner(command)
command = '/usr/bin/cyberpanel_utility'
ProcessUtilities.executioner(command)
elif args.function == 'upgrade' or args.function == 'update':
if not os.path.exists('/usr/bin/cyberpanel_utility'):
command = 'wget -q -O /usr/bin/cyberpanel_utility https://cyberpanel.sh/misc/cyberpanel_utility.sh'
ProcessUtilities.executioner(command)
command = 'chmod 700 /usr/bin/cyberpanel_utility'
ProcessUtilities.executioner(command)
command = '/usr/bin/cyberpanel_utility --upgrade'
ProcessUtilities.executioner(command)
elif args.function == 'help':
if not os.path.exists('/usr/bin/cyberpanel_utility'):
command = 'wget -q -O /usr/bin/cyberpanel_utility https://cyberpanel.sh/misc/cyberpanel_utility.sh'
ProcessUtilities.executioner(command)
command = 'chmod 700 /usr/bin/cyberpanel_utility'
ProcessUtilities.executioner(command)
command = '/usr/bin/cyberpanel_utility --help'
ProcessUtilities.executioner(command)
if __name__ == "__main__":

View File

@@ -44,7 +44,9 @@ class FileManager:
domainName = self.data['domainName']
website = Websites.objects.get(domain=domainName)
if not self.data['completeStartingPath'].find(self.data['home']) > -1:
pathCheck = '/home/%s' % (domainName)
if self.data['completeStartingPath'].find(pathCheck) == -1:
return self.ajaxPre(0, 'Not allowed to browse this path, going back home!')
command = "ls -la --group-directories-first " + self.returnPathEnclosed(
@@ -332,8 +334,9 @@ class FileManager:
fs = FileSystemStorage()
filename = fs.save(myfile.name, myfile)
finalData['fileName'] = fs.url(filename)
pathCheck = '/home/%s' % (self.data['domainName'])
if not self.data['completePath'].find(self.data['home']) > -1:
if self.data['completePath'].find(pathCheck) == -1:
return self.ajaxPre(0, 'Not allowed to move in this path, please choose location inside home!')
command = 'mv ' + self.returnPathEnclosed('/home/cyberpanel/media/' + myfile.name) + ' ' + self.returnPathEnclosed(self.data['completePath'] + '/' + myfile.name)

Binary file not shown.

View File

@@ -444,22 +444,22 @@ class ACLManager:
domainsList = []
if currentACL['admin'] == 1:
domains = Domains.objects.all()
domains = Websites.objects.all()
for items in domains:
domainsList.append(items.name)
domainsList.append(items.domain)
else:
admin = Administrator.objects.get(pk=userID)
domains = admin.domains_set.all()
domains = admin.websites_set.all()
for items in domains:
domainsList.append(items.name)
domainsList.append(items.domain)
admins = Administrator.objects.filter(owner=admin.pk)
for items in admins:
doms = items.domains_set.all()
doms = items.websites_set.all()
for dom in doms:
domainsList.append(dom.name)
domainsList.append(dom.domain)
return domainsList

View File

@@ -22,15 +22,17 @@ class backupScheduleLocal:
localBackupPath = '/home/cyberpanel/localBackupPath'
now = datetime.now()
@staticmethod
def prepare():
try:
backupLogPath = "/usr/local/lscp/logs/local_backup_log." + time.strftime("%m.%d.%Y_%H-%M-%S")
backupRunTime = time.strftime("%m.%d.%Y_%H-%M-%S")
backupLogPath = "/usr/local/lscp/logs/local_backup_log." + backupRunTime
writeToFile = open(backupLogPath, "a")
backupSchedule.remoteBackupLogging(backupLogPath, "#################################################")
backupSchedule.remoteBackupLogging(backupLogPath," Local Backup log for: " + time.strftime("%m.%d.%Y_%H-%M-%S"))
backupSchedule.remoteBackupLogging(backupLogPath," Local Backup log for: " + backupRunTime)
backupSchedule.remoteBackupLogging(backupLogPath, "#################################################\n")
backupSchedule.remoteBackupLogging(backupLogPath, "")
@@ -43,7 +45,7 @@ class backupScheduleLocal:
if os.path.exists(backupScheduleLocal.localBackupPath):
backupPath = retValues[1] + ".tar.gz"
localBackupPath = '%s/%s' % (open(backupScheduleLocal.localBackupPath, 'r').read().rstrip('/'), time.strftime("%b-%d-%Y"))
localBackupPath = '%s/%s' % (open(backupScheduleLocal.localBackupPath, 'r').read().rstrip('/'), backupRunTime)
command = 'mkdir -p %s' % (localBackupPath)
ProcessUtilities.normalExecutioner(command)

View File

@@ -1665,7 +1665,6 @@ CSRF_COOKIE_SECURE = True
command = "find /usr/local/CyberCP/ -name '*.pyc' -delete"
Upgrade.executioner(command, 0)
Upgrade.stdOut("Permissions updated.")
except BaseException as msg:

View File

@@ -14,7 +14,6 @@ function getCookie(name) {
return cookieValue;
}
var fileManager = angular.module('fileManager', ['angularFileUpload']);
fileManager.config(['$interpolateProvider', function ($interpolateProvider) {
@@ -1483,8 +1482,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
url = "/filemanager/downloadFile";
var downloadURL = $scope.currentPath + "/" + allFilesAndFolders[0];
var indexPublicHTML = downloadURL.indexOf("public_html") + 11;
$window.location.href = '/preview/' + domainName + downloadURL.slice(indexPublicHTML);
window.location.href = url + '?domainName=' + domainName + '&fileToDownload=' + downloadURL;
};

View File

@@ -139,7 +139,10 @@ def submitUserCreation(request):
password = data['password']
websitesLimit = data['websitesLimit']
selectedACL = data['selectedACL']
securityLevel = data['securityLevel']
try:
securityLevel = data['securityLevel']
except:
securityLevel = 'HIGH'
selectedACL = ACL.objects.get(name=selectedACL)
@@ -313,7 +316,10 @@ def saveModifications(request):
firstName = data['firstName']
lastName = data['lastName']
email = data['email']
securityLevel = data['securityLevel']
try:
securityLevel = data['securityLevel']
except:
securityLevel = 'HIGH'
user = Administrator.objects.get(userName=accountUsername)