Merge pull request #586 from whattheserver/backupRetention

Backup retention
This commit is contained in:
WhatTheServer
2021-04-16 09:34:56 -04:00
committed by GitHub
21 changed files with 125 additions and 71 deletions

1
.gitignore vendored
View File

@@ -4,3 +4,4 @@
*.pyc
.idea
venv
/.venv/

View File

@@ -1,13 +1,13 @@
from django.db import models
from websiteFunctions.models import Websites
from datetime import datetime
class IncJob(models.Model):
website = models.ForeignKey(Websites, on_delete=models.CASCADE)
date = models.DateTimeField(default=datetime.now, blank=True)
class JobSnapshots(models.Model):
job = models.ForeignKey(IncJob, on_delete=models.CASCADE)
type = models.CharField(max_length=300)
@@ -21,10 +21,9 @@ class BackupJob(models.Model):
websiteData = models.IntegerField()
websiteDatabases = models.IntegerField()
websiteDataEmails = models.IntegerField()
retention = models.IntegerField(default=0) # 0 being unlimited retention
class JobSites(models.Model):
job = models.ForeignKey(BackupJob, on_delete=models.CASCADE)
website = models.CharField(max_length=300)

View File

@@ -599,6 +599,7 @@ app.controller('scheduleBackupInc', function ($scope, $http) {
var data = {
backupDestinations: $scope.backupDest,
backupFreq: $scope.backupFreq,
backupRetention: $scope.backupRetention,
websiteData: $scope.websiteData,
websiteEmails: $scope.websiteEmails,
websiteDatabases: $scope.websiteDatabases,

View File

@@ -10,7 +10,7 @@
<div class="container">
<div id="page-title">
<h2>{% trans "Schedule Back up" %} - <a target="_blank" href="http://cyberpanel.net/"
<h2>{% trans "Schedule Back up" %} - <a target="_blank" href="https://cyberpanel.net/"
style="height: 23px;line-height: 21px;"
class="btn btn-border btn-alt border-red btn-link font-red"
title=""><span>{% trans "Remote Backups" %}</span></a></h2>
@@ -50,6 +50,18 @@
</div>
</div>
<div ng-hide="scheduleRetention" class="form-group">
<label class="col-sm-3 control-label">{% trans "Select Backup Retention. Leave 0 for no limit" %}</label>
<div class="col-sm-9">
<div class="number">
<label>
<input ng-model="backupRetention" type="number" value="0">
</label>
</div>
</div>
</div>
<div ng-hide="scheduleFreq" class="form-group">
<label class="col-sm-3 control-label">{% trans "Backup Content" %}</label>
<div class="col-sm-9">

View File

@@ -500,7 +500,7 @@ def restore_point(request):
def schedule_backups(request):
try:
user_id, current_acl = _get_user_acl(request)
if ACLManager.currentContextPermission(current_acl, 'scheDuleBackups') == 0:
if ACLManager.currentContextPermission(current_acl, 'scheduleBackups') == 0:
return ACLManager.loadError()
websites = ACLManager.findAllSites(current_acl, user_id)
@@ -508,7 +508,7 @@ def schedule_backups(request):
destinations = _get_destinations(local=True)
return def_renderer(request, 'IncBackups/backupSchedule.html',
{'websiteList': websites, 'destinations': destinations}, 'scheDuleBackups')
{'websiteList': websites, 'destinations': destinations}, 'scheduleBackups')
except BaseException as msg:
logging.writeToFile(str(msg))
return redirect(loadLoginPage)
@@ -517,13 +517,14 @@ def schedule_backups(request):
def submit_backup_schedule(request):
try:
user_id, current_acl = _get_user_acl(request)
if ACLManager.currentContextPermission(current_acl, 'scheDuleBackups') == 0:
if ACLManager.currentContextPermission(current_acl, 'scheduleBackups') == 0:
return ACLManager.loadErrorJson('scheduleStatus', 0)
data = json.loads(request.body)
backup_dest = data['backupDestinations']
backup_freq = data['backupFreq']
backup_retention = data['backupRetention']
backup_sites = data['websitesToBeBacked']
backup_data = 1 if 'websiteData' in data else 0
@@ -531,7 +532,8 @@ def submit_backup_schedule(request):
backup_databases = 1 if 'websiteDatabases' in data else 0
backup_job = BackupJob(websiteData=backup_data, websiteDataEmails=backup_emails,
websiteDatabases=backup_databases, destination=backup_dest, frequency=backup_freq)
websiteDatabases=backup_databases, destination=backup_dest, frequency=backup_freq,
retention=backup_retention)
backup_job.save()
for site in backup_sites:
@@ -548,7 +550,7 @@ def submit_backup_schedule(request):
def get_current_backup_schedules(request):
try:
user_id, current_acl = _get_user_acl(request)
if ACLManager.currentContextPermission(current_acl, 'scheDuleBackups') == 0:
if ACLManager.currentContextPermission(current_acl, 'scheduleBackups') == 0:
return ACLManager.loadErrorJson('fetchStatus', 0)
records = BackupJob.objects.all()
@@ -558,6 +560,7 @@ def get_current_backup_schedules(request):
json_data.append({'id': items.id,
'destination': items.destination,
'frequency': items.frequency,
'retention': items.retention,
'numberOfSites': items.jobsites_set.all().count()
})
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data})
@@ -571,7 +574,7 @@ def get_current_backup_schedules(request):
def fetch_sites(request):
try:
user_id, current_acl = _get_user_acl(request)
if ACLManager.currentContextPermission(current_acl, 'scheDuleBackups') == 0:
if ACLManager.currentContextPermission(current_acl, 'scheduleBackups') == 0:
return ACLManager.loadErrorJson('fetchStatus', 0)
data = json.loads(request.body)
@@ -596,7 +599,7 @@ def fetch_sites(request):
def schedule_delete(request):
try:
user_id, current_acl = _get_user_acl(request)
if ACLManager.currentContextPermission(current_acl, 'scheDuleBackups') == 0:
if ACLManager.currentContextPermission(current_acl, 'scheduleBackups') == 0:
return ACLManager.loadErrorJson('scheduleStatus', 0)
data = json.loads(request.body)
@@ -633,7 +636,7 @@ def restore_remote_backups(request):
def save_changes(request):
try:
user_id, current_acl = _get_user_acl(request)
if ACLManager.currentContextPermission(current_acl, 'scheDuleBackups') == 0:
if ACLManager.currentContextPermission(current_acl, 'scheduleBackups') == 0:
return ACLManager.loadErrorJson('scheduleStatus', 0)
data = json.loads(request.body)
@@ -661,7 +664,7 @@ def save_changes(request):
def remove_site(request):
try:
_, current_acl = _get_user_acl(request)
if ACLManager.currentContextPermission(current_acl, 'scheDuleBackups') == 0:
if ACLManager.currentContextPermission(current_acl, 'scheduleBackups') == 0:
return ACLManager.loadErrorJson('scheduleStatus', 0)
data = json.loads(request.body)
@@ -682,7 +685,7 @@ def remove_site(request):
def add_website(request):
try:
_, current_acl = _get_user_acl(request)
if ACLManager.currentContextPermission(current_acl, 'scheDuleBackups') == 0:
if ACLManager.currentContextPermission(current_acl, 'scheduleBackups') == 0:
return ACLManager.loadErrorJson('scheduleStatus', 0)
data = json.loads(request.body)

View File

@@ -845,14 +845,14 @@ class BackupManager:
dests.append(dest.name)
websitesName = ACLManager.findAllSites(currentACL, userID)
proc = httpProc(request, 'backup/backupSchedule.html', {'destinations': dests, 'websites': websitesName},
'scheDuleBackups')
'scheduleBackups')
return proc.render()
def getCurrentBackupSchedules(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
if ACLManager.currentContextPermission(currentACL, 'scheDuleBackups') == 0:
if ACLManager.currentContextPermission(currentACL, 'scheduleBackups') == 0:
return ACLManager.loadErrorJson('fetchStatus', 0)
records = backupSchedules.objects.all()
@@ -886,15 +886,17 @@ class BackupManager:
selectedAccount = data['selectedAccount']
name = data['name']
backupFrequency = data['backupFrequency']
backupRetention = data['backupRetention']
currentACL = ACLManager.loadedACL(userID)
if ACLManager.currentContextPermission(currentACL, 'scheDuleBackups') == 0:
if ACLManager.currentContextPermission(currentACL, 'scheduleBackups') == 0:
return ACLManager.loadErrorJson('scheduleStatus', 0)
nbd = NormalBackupDests.objects.get(name=selectedAccount)
config = {'frequency': backupFrequency}
config = {'frequency': backupFrequency,
'retention': backupRetention}
nbj = NormalBackupJobs(owner=nbd, name=name, config=json.dumps(config))
nbj.save()
@@ -910,7 +912,7 @@ class BackupManager:
try:
currentACL = ACLManager.loadedACL(userID)
if ACLManager.currentContextPermission(currentACL, 'scheDuleBackups') == 0:
if ACLManager.currentContextPermission(currentACL, 'scheduleBackups') == 0:
return ACLManager.loadErrorJson('scheduleStatus', 0)
backupDest = data['destLoc']
@@ -1413,7 +1415,7 @@ class BackupManager:
page = int(str(data['page']).strip('\n'))
if ACLManager.currentContextPermission(currentACL, 'scheDuleBackups') == 0:
if ACLManager.currentContextPermission(currentACL, 'scheduleBackups') == 0:
return ACLManager.loadErrorJson('scheduleStatus', 0)
nbd = NormalBackupJobs.objects.get(name=selectedAccount)
@@ -1465,6 +1467,11 @@ class BackupManager:
except:
frequency = 'Never'
try:
retention = config[IncScheduler.retention]
except:
retention = 'Never'
try:
currentStatus = config[IncScheduler.currentStatus]
except:
@@ -1499,7 +1506,7 @@ class BackupManager:
nbd = NormalBackupDests.objects.get(name=selectedAccount)
if ACLManager.currentContextPermission(currentACL, 'scheDuleBackups') == 0:
if ACLManager.currentContextPermission(currentACL, 'scheduleBackups') == 0:
return ACLManager.loadErrorJson('scheduleStatus', 0)
allJobs = nbd.normalbackupjobs_set.all()
@@ -1526,7 +1533,7 @@ class BackupManager:
data = json.loads(request.body)
if ACLManager.currentContextPermission(currentACL, 'scheDuleBackups') == 0:
if ACLManager.currentContextPermission(currentACL, 'scheduleBackups') == 0:
return ACLManager.loadErrorJson('scheduleStatus', 0)
selectedJob = data['selectedJob']
@@ -1587,7 +1594,7 @@ class BackupManager:
nbj = NormalBackupJobs.objects.get(name=selectedJob)
website = Websites.objects.get(domain=selectedWebsite)
if ACLManager.currentContextPermission(currentACL, 'scheDuleBackups') == 0:
if ACLManager.currentContextPermission(currentACL, 'scheduleBackups') == 0:
return ACLManager.loadErrorJson('scheduleStatus', 0)
try:
@@ -1615,14 +1622,16 @@ class BackupManager:
selectedJob = data['selectedJob']
backupFrequency = data['backupFrequency']
backupRetention = data['backupRetention']
nbj = NormalBackupJobs.objects.get(name=selectedJob)
if ACLManager.currentContextPermission(currentACL, 'scheDuleBackups') == 0:
if ACLManager.currentContextPermission(currentACL, 'scheduleBackups') == 0:
return ACLManager.loadErrorJson('scheduleStatus', 0)
config = json.loads(nbj.config)
config[IncScheduler.frequency] = backupFrequency
config[IncScheduler.retention] = backupRetention
nbj.config = json.dumps(config)
nbj.save()
@@ -1649,7 +1658,7 @@ class BackupManager:
nbj = NormalBackupJobs.objects.get(name=selectedJob)
if ACLManager.currentContextPermission(currentACL, 'scheDuleBackups') == 0:
if ACLManager.currentContextPermission(currentACL, 'scheduleBackups') == 0:
return ACLManager.loadErrorJson('scheduleStatus', 0)
nbj.delete()
@@ -1676,7 +1685,7 @@ class BackupManager:
recordsToShow = int(data['recordsToShow'])
page = int(str(data['page']).strip('\n'))
if ACLManager.currentContextPermission(currentACL, 'scheDuleBackups') == 0:
if ACLManager.currentContextPermission(currentACL, 'scheduleBackups') == 0:
return ACLManager.loadErrorJson('scheduleStatus', 0)
nbj = NormalBackupJobs.objects.get(name=selectedJob)

View File

@@ -1247,7 +1247,8 @@ app.controller('googleDrive', function ($scope, $http) {
};
var data = {
selectedAccount: $scope.selectedAccount,
backupFrequency: $scope.backupFrequency
backupFrequency: $scope.backupFrequency,
backupRetention: $scope.backupRetention,
};
dataurl = "/backup/changeAccountFrequencygDrive";
@@ -1654,7 +1655,8 @@ app.controller('scheduleBackup', function ($scope, $http, $window) {
var data = {
selectedAccount: $scope.selectedAccountAdd,
name: $scope.name,
backupFrequency: $scope.backupFrequency
backupFrequency: $scope.backupFrequency,
backupRetention: $scope.backupRetention,
};
dataurl = "/backup/submitBackupSchedule";
@@ -1856,7 +1858,8 @@ app.controller('scheduleBackup', function ($scope, $http, $window) {
};
var data = {
selectedJob: $scope.selectedJob,
backupFrequency: $scope.backupFrequency
backupFrequency: $scope.backupFrequency,
backupRetention: $scope.backupRetention,
};
dataurl = "/backup/changeAccountFrequencyNormal";

View File

@@ -12,7 +12,7 @@
<div ng-controller="scheduleBackup" class="container">
<div id="page-title">
<h2>{% trans "Schedule Back up" %} - <a target="_blank"
href="http://go.cyberpanel.net/remote-backup"
href="https://go.cyberpanel.net/remote-backup"
style="height: 23px;line-height: 21px; text-decoration: underline"
class="btn btn-border btn-alt border-red btn-link font-red"
title=""><span>{% trans "Remote Backups" %}</span></a>
@@ -24,7 +24,7 @@
<div class="panel-body">
<h3 class="title-hero">
{% trans "Create New Backup Schedule" %} <img ng-hide="cyberPanelLoading"
src="{% static 'images/loading.gif' %}">
src="{% static 'images/loading.gif' %}" alt="cyberPanelLoading">
</h3>
<div class="example-box-wrapper">
@@ -61,6 +61,16 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">{% trans "Select Backup Retention. Leave 0 for no limit" %}</label>
<div class="col-sm-9">
<div class="number">
<label>
<input ng-model="backupRetention" type="number" value="0">
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-4">
@@ -81,7 +91,7 @@
<div class="panel-body">
<h3 class="title-hero">
{% trans "Manage Existing Back up Schedules" %} <img ng-hide="cyberPanelLoading"
src="{% static 'images/loading.gif' %}">
src="{% static 'images/loading.gif' %}" alt="cyberPanelLoading">
</h3>
<div class="example-box-wrapper">
@@ -133,6 +143,7 @@
<th>Last Run</th>
<th>All Sites</th>
<th>Frequency ({$ currently $})</th>
<th>Retention ({$ currently $})</th>
<th>Current Status</th>
</tr>
</thead>

View File

@@ -69,7 +69,7 @@
{% endif %}
{% if scheDuleBackups or admin %}
{% if scheduleBackups or admin %}
<div class="col-md-3 btn-min-width">
<a href="{% url 'scheduleBackup' %}" title="{% trans 'Schedule Back up' %}" class="tile-box tile-box-shortcut btn-primary">

View File

@@ -317,8 +317,8 @@ app.controller('adminController', function ($scope, $http, $timeout) {
$('.addDeleteDestinations').hide();
}
if (!Boolean(response.data.scheDuleBackups)) {
$('.scheDuleBackups').hide();
if (!Boolean(response.data.scheduleBackups)) {
$('.scheduleBackups').hide();
}
if (!Boolean(response.data.remoteBackups)) {

View File

@@ -657,7 +657,7 @@
title="{% trans 'Add Destination' %}"><span>{% trans "Add/Delete Destination" %}</span></a>
</li>
{% endif %}
{% if admin or scheDuleBackups %}
{% if admin or scheduleBackups %}
<li><a href="{% url 'scheduleBackup' %}"
title="{% trans 'Schedule Back up' %}"><span>{% trans "Schedule Back up" %}</span></a>
</li>

View File

@@ -64,7 +64,7 @@ class ACL(models.Model):
createBackup = models.IntegerField(default=1)
restoreBackup = models.IntegerField(default=0)
addDeleteDestinations = models.IntegerField(default=0)
scheDuleBackups = models.IntegerField(default=0)
scheduleBackups = models.IntegerField(default=0)
remoteBackups = models.IntegerField(default=0)
## SSL Management

View File

@@ -7,6 +7,18 @@ import smtplib
class CyberCPLogFileWriter:
fileName = "/home/cyberpanel/error-logs.txt"
@staticmethod
def AddFromHeader(sender, message):
try:
import re
if not re.search('^From: ', message, re.MULTILINE):
message = 'From: {}\n{}'.format(sender, message)
return message
except BaseException as msg:
CyberCPLogFileWriter.writeToFile(str(msg) + ' [AddFromHeader]')
@staticmethod
def SendEmail(sender, receivers, message, subject=None, type=None):
try:
@@ -29,9 +41,12 @@ class CyberCPLogFileWriter:
if subject != None:
message = 'Subject: {}\n\n{}'.format(subject, message)
message = CyberCPLogFileWriter.AddFromHeader(sender, message)
smtpServer.sendmail(smtpUserName, receivers, message)
else:
smtpObj = smtplib.SMTP('localhost')
message = CyberCPLogFileWriter.AddFromHeader(sender, message)
smtpObj.sendmail(sender, receivers, message)
except BaseException as msg:
CyberCPLogFileWriter.writeToFile(str(msg))
@@ -107,4 +122,4 @@ Subject: %s
statusFile.writelines(mesg + '\n')
statusFile.close()
except BaseException as msg:
CyberCPLogFileWriter.writeToFile(str(msg) + ' [statusWriter]')
CyberCPLogFileWriter.writeToFile(str(msg) + ' [statusWriter]')

View File

@@ -23,7 +23,7 @@ class ACLManager:
'"listDatabases": 1, "createNameServer": 1, "createDNSZone": 1, "deleteZone": 1, "addDeleteRecords": 1, ' \
'"createEmail": 1, "listEmails": 1, "deleteEmail": 1, "emailForwarding": 1, "changeEmailPassword": 1, ' \
'"dkimManager": 1, "createFTPAccount": 1, "deleteFTPAccount": 1, "listFTPAccounts": 1, "createBackup": 1,' \
' "restoreBackup": 1, "addDeleteDestinations": 1, "scheDuleBackups": 1, "remoteBackups": 1, "googleDriveBackups": 1, "manageSSL": 1, ' \
' "restoreBackup": 1, "addDeleteDestinations": 1, "scheduleBackups": 1, "remoteBackups": 1, "googleDriveBackups": 1, "manageSSL": 1, ' \
'"hostnameSSL": 1, "mailServerSSL": 1 }'
ResellerACL = '{"adminStatus":0, "versionManagement": 1, "createNewUser": 1, "listUsers": 1, "deleteUser": 1 , "resellerCenter": 1, ' \
@@ -32,7 +32,7 @@ class ACLManager:
'"listDatabases": 1, "createNameServer": 1, "createDNSZone": 1, "deleteZone": 1, "addDeleteRecords": 1, ' \
'"createEmail": 1, "listEmails": 1, "deleteEmail": 1, "emailForwarding": 1, "changeEmailPassword": 1, ' \
'"dkimManager": 1, "createFTPAccount": 1, "deleteFTPAccount": 1, "listFTPAccounts": 1, "createBackup": 1,' \
' "restoreBackup": 1, "addDeleteDestinations": 0, "scheDuleBackups": 0, "remoteBackups": 0, "googleDriveBackups": 1, "manageSSL": 1, ' \
' "restoreBackup": 1, "addDeleteDestinations": 0, "scheduleBackups": 0, "remoteBackups": 0, "googleDriveBackups": 1, "manageSSL": 1, ' \
'"hostnameSSL": 0, "mailServerSSL": 0 }'
UserACL = '{"adminStatus":0, "versionManagement": 1, "createNewUser": 0, "listUsers": 0, "deleteUser": 0 , "resellerCenter": 0, ' \
@@ -41,7 +41,7 @@ class ACLManager:
'"listDatabases": 1, "createNameServer": 0, "createDNSZone": 1, "deleteZone": 1, "addDeleteRecords": 1, ' \
'"createEmail": 1, "listEmails": 1, "deleteEmail": 1, "emailForwarding": 1, "changeEmailPassword": 1, ' \
'"dkimManager": 1, "createFTPAccount": 1, "deleteFTPAccount": 1, "listFTPAccounts": 1, "createBackup": 1,' \
' "restoreBackup": 0, "addDeleteDestinations": 0, "scheDuleBackups": 0, "remoteBackups": 0, "googleDriveBackups": 1, "manageSSL": 1, ' \
' "restoreBackup": 0, "addDeleteDestinations": 0, "scheduleBackups": 0, "remoteBackups": 0, "googleDriveBackups": 1, "manageSSL": 1, ' \
'"hostnameSSL": 0, "mailServerSSL": 0 }'
@staticmethod
def FindIfChild():
@@ -180,7 +180,7 @@ class ACLManager:
finalResponse['googleDriveBackups'] = config['googleDriveBackups']
finalResponse['restoreBackup'] = config['restoreBackup']
finalResponse['addDeleteDestinations'] = config['addDeleteDestinations']
finalResponse['scheDuleBackups'] = config['scheDuleBackups']
finalResponse['scheduleBackups'] = config['scheduleBackups']
finalResponse['remoteBackups'] = config['remoteBackups']
## SSL Management

View File

@@ -39,7 +39,7 @@ class Upgrade:
'"listDatabases": 1, "createNameServer": 1, "createDNSZone": 1, "deleteZone": 1, "addDeleteRecords": 1, ' \
'"createEmail": 1, "listEmails": 1, "deleteEmail": 1, "emailForwarding": 1, "changeEmailPassword": 1, ' \
'"dkimManager": 1, "createFTPAccount": 1, "deleteFTPAccount": 1, "listFTPAccounts": 1, "createBackup": 1,' \
' "restoreBackup": 1, "addDeleteDestinations": 1, "scheDuleBackups": 1, "remoteBackups": 1, "googleDriveBackups": 1, "manageSSL": 1, ' \
' "restoreBackup": 1, "addDeleteDestinations": 1, "scheduleBackups": 1, "remoteBackups": 1, "googleDriveBackups": 1, "manageSSL": 1, ' \
'"hostnameSSL": 1, "mailServerSSL": 1 }'
ResellerACL = '{"adminStatus":0, "versionManagement": 1, "createNewUser": 1, "listUsers": 1, "deleteUser": 1 , "resellerCenter": 1, ' \
@@ -48,7 +48,7 @@ class Upgrade:
'"listDatabases": 1, "createNameServer": 1, "createDNSZone": 1, "deleteZone": 1, "addDeleteRecords": 1, ' \
'"createEmail": 1, "listEmails": 1, "deleteEmail": 1, "emailForwarding": 1, "changeEmailPassword": 1, ' \
'"dkimManager": 1, "createFTPAccount": 1, "deleteFTPAccount": 1, "listFTPAccounts": 1, "createBackup": 1,' \
' "restoreBackup": 1, "addDeleteDestinations": 0, "scheDuleBackups": 0, "remoteBackups": 0, "googleDriveBackups": 1, "manageSSL": 1, ' \
' "restoreBackup": 1, "addDeleteDestinations": 0, "scheduleBackups": 0, "remoteBackups": 0, "googleDriveBackups": 1, "manageSSL": 1, ' \
'"hostnameSSL": 0, "mailServerSSL": 0 }'
UserACL = '{"adminStatus":0, "versionManagement": 1, "createNewUser": 0, "listUsers": 0, "deleteUser": 0 , "resellerCenter": 0, ' \
@@ -57,7 +57,7 @@ class Upgrade:
'"listDatabases": 1, "createNameServer": 0, "createDNSZone": 1, "deleteZone": 1, "addDeleteRecords": 1, ' \
'"createEmail": 1, "listEmails": 1, "deleteEmail": 1, "emailForwarding": 1, "changeEmailPassword": 1, ' \
'"dkimManager": 1, "createFTPAccount": 1, "deleteFTPAccount": 1, "listFTPAccounts": 1, "createBackup": 1,' \
' "restoreBackup": 0, "addDeleteDestinations": 0, "scheDuleBackups": 0, "remoteBackups": 0, "googleDriveBackups": 1, "manageSSL": 1, ' \
' "restoreBackup": 0, "addDeleteDestinations": 0, "scheduleBackups": 0, "remoteBackups": 0, "googleDriveBackups": 1, "manageSSL": 1, ' \
'"hostnameSSL": 0, "mailServerSSL": 0 }'
@staticmethod
@@ -602,7 +602,7 @@ imap_folder_list_limit = 0
try:
cursor.execute(
'CREATE TABLE `loginSystem_acl` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `name` varchar(50) NOT NULL UNIQUE, `adminStatus` integer NOT NULL DEFAULT 0, `versionManagement` integer NOT NULL DEFAULT 0, `createNewUser` integer NOT NULL DEFAULT 0, `deleteUser` integer NOT NULL DEFAULT 0, `resellerCenter` integer NOT NULL DEFAULT 0, `changeUserACL` integer NOT NULL DEFAULT 0, `createWebsite` integer NOT NULL DEFAULT 0, `modifyWebsite` integer NOT NULL DEFAULT 0, `suspendWebsite` integer NOT NULL DEFAULT 0, `deleteWebsite` integer NOT NULL DEFAULT 0, `createPackage` integer NOT NULL DEFAULT 0, `deletePackage` integer NOT NULL DEFAULT 0, `modifyPackage` integer NOT NULL DEFAULT 0, `createDatabase` integer NOT NULL DEFAULT 0, `deleteDatabase` integer NOT NULL DEFAULT 0, `listDatabases` integer NOT NULL DEFAULT 0, `createNameServer` integer NOT NULL DEFAULT 0, `createDNSZone` integer NOT NULL DEFAULT 0, `deleteZone` integer NOT NULL DEFAULT 0, `addDeleteRecords` integer NOT NULL DEFAULT 0, `createEmail` integer NOT NULL DEFAULT 0, `deleteEmail` integer NOT NULL DEFAULT 0, `emailForwarding` integer NOT NULL DEFAULT 0, `changeEmailPassword` integer NOT NULL DEFAULT 0, `dkimManager` integer NOT NULL DEFAULT 0, `createFTPAccount` integer NOT NULL DEFAULT 0, `deleteFTPAccount` integer NOT NULL DEFAULT 0, `listFTPAccounts` integer NOT NULL DEFAULT 0, `createBackup` integer NOT NULL DEFAULT 0, `restoreBackup` integer NOT NULL DEFAULT 0, `addDeleteDestinations` integer NOT NULL DEFAULT 0, `scheDuleBackups` integer NOT NULL DEFAULT 0, `remoteBackups` integer NOT NULL DEFAULT 0, `manageSSL` integer NOT NULL DEFAULT 0, `hostnameSSL` integer NOT NULL DEFAULT 0, `mailServerSSL` integer NOT NULL DEFAULT 0)')
'CREATE TABLE `loginSystem_acl` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `name` varchar(50) NOT NULL UNIQUE, `adminStatus` integer NOT NULL DEFAULT 0, `versionManagement` integer NOT NULL DEFAULT 0, `createNewUser` integer NOT NULL DEFAULT 0, `deleteUser` integer NOT NULL DEFAULT 0, `resellerCenter` integer NOT NULL DEFAULT 0, `changeUserACL` integer NOT NULL DEFAULT 0, `createWebsite` integer NOT NULL DEFAULT 0, `modifyWebsite` integer NOT NULL DEFAULT 0, `suspendWebsite` integer NOT NULL DEFAULT 0, `deleteWebsite` integer NOT NULL DEFAULT 0, `createPackage` integer NOT NULL DEFAULT 0, `deletePackage` integer NOT NULL DEFAULT 0, `modifyPackage` integer NOT NULL DEFAULT 0, `createDatabase` integer NOT NULL DEFAULT 0, `deleteDatabase` integer NOT NULL DEFAULT 0, `listDatabases` integer NOT NULL DEFAULT 0, `createNameServer` integer NOT NULL DEFAULT 0, `createDNSZone` integer NOT NULL DEFAULT 0, `deleteZone` integer NOT NULL DEFAULT 0, `addDeleteRecords` integer NOT NULL DEFAULT 0, `createEmail` integer NOT NULL DEFAULT 0, `deleteEmail` integer NOT NULL DEFAULT 0, `emailForwarding` integer NOT NULL DEFAULT 0, `changeEmailPassword` integer NOT NULL DEFAULT 0, `dkimManager` integer NOT NULL DEFAULT 0, `createFTPAccount` integer NOT NULL DEFAULT 0, `deleteFTPAccount` integer NOT NULL DEFAULT 0, `listFTPAccounts` integer NOT NULL DEFAULT 0, `createBackup` integer NOT NULL DEFAULT 0, `restoreBackup` integer NOT NULL DEFAULT 0, `addDeleteDestinations` integer NOT NULL DEFAULT 0, `scheduleBackups` integer NOT NULL DEFAULT 0, `remoteBackups` integer NOT NULL DEFAULT 0, `manageSSL` integer NOT NULL DEFAULT 0, `hostnameSSL` integer NOT NULL DEFAULT 0, `mailServerSSL` integer NOT NULL DEFAULT 0)')
except:
pass
try:
@@ -2412,7 +2412,7 @@ vmail
if acl.name == 'admin' or acl.name == 'reseller' or acl.name == 'user':
continue
elif acl.config == '{}':
acl.config = '{"adminStatus":%s, "versionManagement": %s, "createNewUser": %s, "listUsers": %s, "deleteUser": %s, "resellerCenter": %s, "changeUserACL": %s, "createWebsite": %s, "modifyWebsite": %s, "suspendWebsite": %s, "deleteWebsite": %s, "createPackage": %s, "listPackages": %s, "deletePackage": %s, "modifyPackage": %s, "createDatabase": %s, "deleteDatabase": %s, "listDatabases": %s, "createNameServer": %s, "createDNSZone": %s, "deleteZone": %s, "addDeleteRecords": %s, "createEmail": %s, "listEmails": %s, "deleteEmail": %s, "emailForwarding": %s, "changeEmailPassword": %s, "dkimManager": %s, "createFTPAccount": %s, "deleteFTPAccount": %s, "listFTPAccounts": %s, "createBackup": %s, "restoreBackup": %s, "addDeleteDestinations": %s, "scheDuleBackups": %s, "remoteBackups": %s, "googleDriveBackups": %s, "manageSSL": %s, "hostnameSSL": %s, "mailServerSSL": %s }' \
acl.config = '{"adminStatus":%s, "versionManagement": %s, "createNewUser": %s, "listUsers": %s, "deleteUser": %s, "resellerCenter": %s, "changeUserACL": %s, "createWebsite": %s, "modifyWebsite": %s, "suspendWebsite": %s, "deleteWebsite": %s, "createPackage": %s, "listPackages": %s, "deletePackage": %s, "modifyPackage": %s, "createDatabase": %s, "deleteDatabase": %s, "listDatabases": %s, "createNameServer": %s, "createDNSZone": %s, "deleteZone": %s, "addDeleteRecords": %s, "createEmail": %s, "listEmails": %s, "deleteEmail": %s, "emailForwarding": %s, "changeEmailPassword": %s, "dkimManager": %s, "createFTPAccount": %s, "deleteFTPAccount": %s, "listFTPAccounts": %s, "createBackup": %s, "restoreBackup": %s, "addDeleteDestinations": %s, "scheduleBackups": %s, "remoteBackups": %s, "googleDriveBackups": %s, "manageSSL": %s, "hostnameSSL": %s, "mailServerSSL": %s }' \
% (str(acl.adminStatus), str(acl.versionManagement), str(acl.createNewUser),
str(acl.listUsers), str(acl.deleteUser), str(acl.resellerCenter), str(acl.changeUserACL),
str(acl.createWebsite), str(acl.modifyWebsite), str(acl.suspendWebsite), str(acl.deleteWebsite),
@@ -2421,7 +2421,7 @@ vmail
str(acl.createDNSZone), str(acl.deleteZone), str(acl.addDeleteRecords), str(acl.createEmail),
str(acl.listEmails), str(acl.deleteEmail), str(acl.emailForwarding), str(acl.changeEmailPassword),
str(acl.dkimManager), str(acl.createFTPAccount), str(acl.deleteFTPAccount), str(acl.listFTPAccounts),
str(acl.createBackup), str(acl.restoreBackup), str(acl.addDeleteDestinations), str(acl.scheDuleBackups), str(acl.remoteBackups), '1',
str(acl.createBackup), str(acl.restoreBackup), str(acl.addDeleteDestinations), str(acl.scheduleBackups), str(acl.remoteBackups), '1',
str(acl.manageSSL), str(acl.hostnameSSL), str(acl.mailServerSSL))
acl.save()

View File

@@ -317,8 +317,8 @@ app.controller('adminController', function ($scope, $http, $timeout) {
$('.addDeleteDestinations').hide();
}
if (!Boolean(response.data.scheDuleBackups)) {
$('.scheDuleBackups').hide();
if (!Boolean(response.data.scheduleBackups)) {
$('.scheduleBackups').hide();
}
if (!Boolean(response.data.remoteBackups)) {

View File

@@ -524,7 +524,7 @@ app.controller('createACLCTRL', function ($scope, $http) {
$scope.googleDriveBackups = true;
$scope.restoreBackup = false;
$scope.addDeleteDestinations = false;
$scope.scheDuleBackups = false;
$scope.scheduleBackups = false;
$scope.remoteBackups = false;
@@ -605,7 +605,7 @@ app.controller('createACLCTRL', function ($scope, $http) {
googleDriveBackups: $scope.googleDriveBackups,
restoreBackup: $scope.restoreBackup,
addDeleteDestinations: $scope.addDeleteDestinations,
scheDuleBackups: $scope.scheDuleBackups,
scheduleBackups: $scope.scheduleBackups,
remoteBackups: $scope.remoteBackups,
// SSL Management
@@ -727,7 +727,7 @@ app.controller('createACLCTRL', function ($scope, $http) {
$scope.createBackup = true;
$scope.restoreBackup = true;
$scope.addDeleteDestinations = true;
$scope.scheDuleBackups = true;
$scope.scheduleBackups = true;
$scope.remoteBackups = true;
// SSL Management
@@ -798,7 +798,7 @@ app.controller('createACLCTRL', function ($scope, $http) {
$scope.createBackup = true;
$scope.restoreBackup = false;
$scope.addDeleteDestinations = false;
$scope.scheDuleBackups = false;
$scope.scheduleBackups = false;
$scope.remoteBackups = false;
// SSL Management
@@ -983,7 +983,7 @@ app.controller('modifyACLCtrl', function ($scope, $http) {
$scope.googleDriveBackups = Boolean(response.data.googleDriveBackups);
$scope.restoreBackup = Boolean(response.data.restoreBackup);
$scope.addDeleteDestinations = Boolean(response.data.addDeleteDestinations);
$scope.scheDuleBackups = Boolean(response.data.scheDuleBackups);
$scope.scheduleBackups = Boolean(response.data.scheduleBackups);
$scope.remoteBackups = Boolean(response.data.remoteBackups);
// SSL Management
@@ -1084,7 +1084,7 @@ app.controller('modifyACLCtrl', function ($scope, $http) {
googleDriveBackups: $scope.googleDriveBackups,
restoreBackup: $scope.restoreBackup,
addDeleteDestinations: $scope.addDeleteDestinations,
scheDuleBackups: $scope.scheDuleBackups,
scheduleBackups: $scope.scheduleBackups,
remoteBackups: $scope.remoteBackups,
// SSL Management
@@ -1206,7 +1206,7 @@ app.controller('modifyACLCtrl', function ($scope, $http) {
$scope.createBackup = true;
$scope.restoreBackup = true;
$scope.addDeleteDestinations = true;
$scope.scheDuleBackups = true;
$scope.scheduleBackups = true;
$scope.remoteBackups = true;
// SSL Management
@@ -1277,7 +1277,7 @@ app.controller('modifyACLCtrl', function ($scope, $http) {
$scope.createBackup = true;
$scope.restoreBackup = false;
$scope.addDeleteDestinations = false;
$scope.scheDuleBackups = false;
$scope.scheduleBackups = false;
$scope.remoteBackups = false;
// SSL Management

View File

@@ -524,7 +524,7 @@ app.controller('createACLCTRL', function ($scope, $http) {
$scope.googleDriveBackups = true;
$scope.restoreBackup = false;
$scope.addDeleteDestinations = false;
$scope.scheDuleBackups = false;
$scope.scheduleBackups = false;
$scope.remoteBackups = false;
@@ -605,7 +605,7 @@ app.controller('createACLCTRL', function ($scope, $http) {
googleDriveBackups: $scope.googleDriveBackups,
restoreBackup: $scope.restoreBackup,
addDeleteDestinations: $scope.addDeleteDestinations,
scheDuleBackups: $scope.scheDuleBackups,
scheduleBackups: $scope.scheduleBackups,
remoteBackups: $scope.remoteBackups,
// SSL Management
@@ -727,7 +727,7 @@ app.controller('createACLCTRL', function ($scope, $http) {
$scope.createBackup = true;
$scope.restoreBackup = true;
$scope.addDeleteDestinations = true;
$scope.scheDuleBackups = true;
$scope.scheduleBackups = true;
$scope.remoteBackups = true;
// SSL Management
@@ -798,7 +798,7 @@ app.controller('createACLCTRL', function ($scope, $http) {
$scope.createBackup = true;
$scope.restoreBackup = false;
$scope.addDeleteDestinations = false;
$scope.scheDuleBackups = false;
$scope.scheduleBackups = false;
$scope.remoteBackups = false;
// SSL Management
@@ -983,7 +983,7 @@ app.controller('modifyACLCtrl', function ($scope, $http) {
$scope.googleDriveBackups = Boolean(response.data.googleDriveBackups);
$scope.restoreBackup = Boolean(response.data.restoreBackup);
$scope.addDeleteDestinations = Boolean(response.data.addDeleteDestinations);
$scope.scheDuleBackups = Boolean(response.data.scheDuleBackups);
$scope.scheduleBackups = Boolean(response.data.scheduleBackups);
$scope.remoteBackups = Boolean(response.data.remoteBackups);
// SSL Management
@@ -1084,7 +1084,7 @@ app.controller('modifyACLCtrl', function ($scope, $http) {
googleDriveBackups: $scope.googleDriveBackups,
restoreBackup: $scope.restoreBackup,
addDeleteDestinations: $scope.addDeleteDestinations,
scheDuleBackups: $scope.scheDuleBackups,
scheduleBackups: $scope.scheduleBackups,
remoteBackups: $scope.remoteBackups,
// SSL Management
@@ -1206,7 +1206,7 @@ app.controller('modifyACLCtrl', function ($scope, $http) {
$scope.createBackup = true;
$scope.restoreBackup = true;
$scope.addDeleteDestinations = true;
$scope.scheDuleBackups = true;
$scope.scheduleBackups = true;
$scope.remoteBackups = true;
// SSL Management
@@ -1277,7 +1277,7 @@ app.controller('modifyACLCtrl', function ($scope, $http) {
$scope.createBackup = true;
$scope.restoreBackup = false;
$scope.addDeleteDestinations = false;
$scope.scheDuleBackups = false;
$scope.scheduleBackups = false;
$scope.remoteBackups = false;
// SSL Management

View File

@@ -388,7 +388,7 @@
<div class="col-sm-9">
<div class="checkbox">
<label>
<input ng-model="scheDuleBackups" type="checkbox" value="">
<input ng-model="scheduleBackups" type="checkbox" value="">
{% trans "Schedule Back up" %}
</label>
</div>

View File

@@ -392,7 +392,7 @@
<div class="col-sm-9">
<div class="checkbox">
<label>
<input ng-model="scheDuleBackups" type="checkbox" value="">
<input ng-model="scheduleBackups" type="checkbox" value="">
{% trans "Schedule Back up" %}
</label>
</div>

View File

@@ -155,7 +155,7 @@ class TestUserManagement(TestCase):
'createBackup': 1,
'restoreBackup': 1,
'addDeleteDestinations': 1,
'scheDuleBackups': 1,
'scheduleBackups': 1,
'remoteBackups': 1,
'manageSSL': 1,
'hostnameSSL': 1,
@@ -221,7 +221,7 @@ class TestUserManagement(TestCase):
'createBackup': 1,
'restoreBackup': 1,
'addDeleteDestinations': 1,
'scheDuleBackups': 1,
'scheduleBackups': 1,
'remoteBackups': 1,
'manageSSL': 1,
'hostnameSSL': 1,