mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-06 13:25:51 +01:00
filemanager overhaul
This commit is contained in:
@@ -17,7 +17,7 @@ class secMiddleware:
|
||||
pass
|
||||
else:
|
||||
continue
|
||||
if key == 'emailMessage' or key == 'configData' or key == 'rewriteRules' or key == 'modSecRules' or key == 'recordContentTXT' or key == 'SecAuditLogRelevantStatus':
|
||||
if key == 'emailMessage' or key == 'configData' or key == 'rewriteRules' or key == 'modSecRules' or key == 'recordContentTXT' or key == 'SecAuditLogRelevantStatus' or key == 'fileContent':
|
||||
continue
|
||||
if value.find(';') > -1 or value.find('&&') > -1 or value.find('|') > -1 or value.find('...') > -1:
|
||||
logging.writeToFile(request.body)
|
||||
|
||||
@@ -187,3 +187,6 @@ LANGUAGES = (
|
||||
('pl', _('Polish')),
|
||||
('vi', _('Vietnamese')),
|
||||
)
|
||||
|
||||
MEDIA_URL = '/home/cyberpanel/media/'
|
||||
MEDIA_ROOT = MEDIA_URL
|
||||
315
filemanager/filemanager.py
Normal file
315
filemanager/filemanager.py
Normal file
@@ -0,0 +1,315 @@
|
||||
from django.shortcuts import HttpResponse
|
||||
import json
|
||||
import subprocess, shlex
|
||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||
from plogical.processUtilities import ProcessUtilities
|
||||
from websiteFunctions.models import Websites
|
||||
from random import randint
|
||||
from django.core.files.storage import FileSystemStorage
|
||||
|
||||
class FileManager:
|
||||
def __init__(self, request, data):
|
||||
self.request = request
|
||||
self.data = data
|
||||
|
||||
|
||||
def ajaxPre(self, status, errorMessage):
|
||||
final_dic = {'status': status, 'error_message': errorMessage, 'uploadStatus': status}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
def returnPathEnclosed(self, path):
|
||||
return "'" + path + "'"
|
||||
|
||||
def changeOwner(self, path):
|
||||
domainName = self.data['domainName']
|
||||
website = Websites.objects.get(domain=domainName)
|
||||
command = "sudo chown -R " + website.externalApp + ':' + website.externalApp + ' ' + self.returnPathEnclosed(path)
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
def listForTable(self):
|
||||
try:
|
||||
finalData = {}
|
||||
finalData['status'] = 1
|
||||
|
||||
if not self.data['completeStartingPath'].find(self.data['home']) > -1:
|
||||
return self.ajaxPre(0, 'Not allowed to browse this path, going back home!')
|
||||
|
||||
command = "sudo ls -la --group-directories-first " + self.returnPathEnclosed(self.data['completeStartingPath'])
|
||||
output = subprocess.check_output(shlex.split(command)).splitlines()
|
||||
|
||||
counter = 0
|
||||
for items in output:
|
||||
currentFile = items.split(' ')
|
||||
currentFile = filter(lambda a: a != '', currentFile)
|
||||
if currentFile[-1] == '.' or currentFile[-1] == '..' or currentFile[0] == 'total':
|
||||
continue
|
||||
dirCheck = 0
|
||||
if currentFile[0][0] == 'd':
|
||||
dirCheck = 1
|
||||
|
||||
size = str(int(int(currentFile[4])/float(1024)))
|
||||
lastModified = currentFile[5] + ' ' + currentFile[6] + ' ' + currentFile[7]
|
||||
finalData[str(counter)] = [currentFile[-1], currentFile[-1], lastModified, size, currentFile[0], dirCheck]
|
||||
counter = counter + 1
|
||||
|
||||
json_data = json.dumps(finalData)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
return self.ajaxPre(0, str(msg))
|
||||
|
||||
def list(self):
|
||||
try:
|
||||
finalData = {}
|
||||
finalData['status'] = 1
|
||||
|
||||
command = "sudo ls -la --group-directories-first " + self.returnPathEnclosed(self.data['completeStartingPath'])
|
||||
output = subprocess.check_output(shlex.split(command)).splitlines()
|
||||
|
||||
counter = 0
|
||||
for items in output:
|
||||
currentFile = items.split(' ')
|
||||
currentFile = filter(lambda a: a != '', currentFile)
|
||||
|
||||
if currentFile[-1] == '.' or currentFile[-1] == '..' or currentFile[0] == 'total':
|
||||
continue
|
||||
|
||||
dirCheck = False
|
||||
if currentFile[0][0] == 'd':
|
||||
dirCheck = True
|
||||
|
||||
finalData[str(counter)] = [currentFile[-1], self.data['completeStartingPath'] + '/' + currentFile[-1], dirCheck]
|
||||
counter = counter + 1
|
||||
|
||||
json_data = json.dumps(finalData)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
return self.ajaxPre(0, str(msg))
|
||||
|
||||
def createNewFile(self):
|
||||
try:
|
||||
finalData = {}
|
||||
finalData['status'] = 1
|
||||
|
||||
command = "sudo touch " + self.returnPathEnclosed(self.data['fileName'])
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
self.changeOwner(self.data['fileName'])
|
||||
|
||||
json_data = json.dumps(finalData)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
return self.ajaxPre(0, str(msg))
|
||||
|
||||
def createNewFolder(self):
|
||||
try:
|
||||
finalData = {}
|
||||
finalData['status'] = 1
|
||||
|
||||
command = "sudo mkdir " + self.returnPathEnclosed(self.data['folderName'])
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
self.changeOwner(self.data['folderName'])
|
||||
|
||||
json_data = json.dumps(finalData)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
return self.ajaxPre(0, str(msg))
|
||||
|
||||
def deleteFolderOrFile(self):
|
||||
try:
|
||||
finalData = {}
|
||||
finalData['status'] = 1
|
||||
|
||||
for item in self.data['fileAndFolders']:
|
||||
command = 'sudo rm -rf ' + self.returnPathEnclosed(self.data['path'] + '/' + item)
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
json_data = json.dumps(finalData)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
return self.ajaxPre(0, str(msg))
|
||||
|
||||
def copy(self):
|
||||
try:
|
||||
|
||||
finalData = {}
|
||||
finalData['status'] = 1
|
||||
|
||||
if not self.data['newPath'].find(self.data['home']) > -1:
|
||||
return self.ajaxPre(0, 'Not allowed to move in this path, please choose location inside home!')
|
||||
|
||||
command = 'sudo mkdir ' + self.returnPathEnclosed(self.data['newPath'])
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
for item in self.data['fileAndFolders']:
|
||||
command = 'sudo cp -R ' + self.returnPathEnclosed(self.data['basePath'] + '/' + item) + ' ' + self.returnPathEnclosed(self.data['newPath'] + '/' + item)
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
self.changeOwner(self.data['newPath'])
|
||||
|
||||
json_data = json.dumps(finalData)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
return self.ajaxPre(0, str(msg))
|
||||
|
||||
def move(self):
|
||||
try:
|
||||
|
||||
finalData = {}
|
||||
finalData['status'] = 1
|
||||
|
||||
if not self.data['newPath'].find(self.data['home']) > -1:
|
||||
return self.ajaxPre(0, 'Not allowed to move in this path, please choose location inside home!')
|
||||
|
||||
command = 'sudo mkdir ' + self.returnPathEnclosed(self.data['newPath'])
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
for item in self.data['fileAndFolders']:
|
||||
command = 'sudo mv ' + self.returnPathEnclosed(self.data['basePath'] + '/' + item) + ' ' + self.returnPathEnclosed(self.data['newPath'] + '/' + item)
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
self.changeOwner(self.data['newPath'])
|
||||
|
||||
json_data = json.dumps(finalData)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
return self.ajaxPre(0, str(msg))
|
||||
|
||||
def rename(self):
|
||||
try:
|
||||
|
||||
finalData = {}
|
||||
finalData['status'] = 1
|
||||
|
||||
|
||||
command = 'sudo mv ' + self.returnPathEnclosed(self.data['basePath'] + '/' + self.data['existingName']) + ' ' + self.returnPathEnclosed(self.data['basePath'] + '/' + self.data['newFileName'])
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
self.changeOwner(self.data['basePath'] + '/' + self.data['newFileName'])
|
||||
|
||||
json_data = json.dumps(finalData)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
return self.ajaxPre(0, str(msg))
|
||||
|
||||
def readFileContents(self):
|
||||
try:
|
||||
|
||||
finalData = {}
|
||||
finalData['status'] = 1
|
||||
|
||||
command = 'sudo cat ' + self.returnPathEnclosed(self.data['fileName'])
|
||||
ProcessUtilities.executioner(command)
|
||||
finalData['fileContents'] = subprocess.check_output(shlex.split(command))
|
||||
|
||||
json_data = json.dumps(finalData)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
return self.ajaxPre(0, str(msg))
|
||||
|
||||
def writeFileContents(self):
|
||||
try:
|
||||
|
||||
finalData = {}
|
||||
finalData['status'] = 1
|
||||
tempPath = "/home/cyberpanel/" + str(randint(1000, 9999))
|
||||
|
||||
writeToFile = open(tempPath, 'w')
|
||||
writeToFile.write(self.data['fileContent'])
|
||||
writeToFile.close()
|
||||
|
||||
command = 'sudo mv ' + tempPath + ' ' + self.returnPathEnclosed(self.data['fileName'])
|
||||
ProcessUtilities.executioner(command)
|
||||
self.changeOwner(self.data['fileName'])
|
||||
|
||||
json_data = json.dumps(finalData)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
return self.ajaxPre(0, str(msg))
|
||||
|
||||
def upload(self):
|
||||
try:
|
||||
|
||||
finalData = {}
|
||||
finalData['uploadStatus'] = 1
|
||||
finalData['answer'] = 'File transfer completed.'
|
||||
|
||||
myfile = self.request.FILES['file']
|
||||
fs = FileSystemStorage()
|
||||
filename = fs.save(myfile.name, myfile)
|
||||
finalData['fileName'] = fs.url(filename)
|
||||
|
||||
command = 'sudo mv ' + self.returnPathEnclosed('/home/cyberpanel/media/' + myfile.name) + ' ' + self.returnPathEnclosed(self.data['completePath'] + '/' + myfile.name)
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
self.changeOwner(self.data['completePath'] + '/' + myfile.name)
|
||||
|
||||
json_data = json.dumps(finalData)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
return self.ajaxPre(0, str(msg))
|
||||
|
||||
def extract(self):
|
||||
try:
|
||||
|
||||
finalData = {}
|
||||
finalData['status'] = 1
|
||||
|
||||
if not self.data['extractionLocation'].find(self.data['home']) > -1:
|
||||
return self.ajaxPre(0, 'Not allowed to move in this path, please choose location inside home!')
|
||||
|
||||
if self.data['extractionType'] == 'zip':
|
||||
command = 'sudo unzip -o ' + self.returnPathEnclosed(self.data['fileToExtract']) + ' -d ' + self.returnPathEnclosed(self.data['extractionLocation'])
|
||||
else:
|
||||
command = 'sudo tar -xf ' + self.returnPathEnclosed(self.data['fileToExtract']) + ' -C ' + self.returnPathEnclosed(self.data['extractionLocation'])
|
||||
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
self.changeOwner(self.data['extractionLocation'])
|
||||
|
||||
json_data = json.dumps(finalData)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
return self.ajaxPre(0, str(msg))
|
||||
|
||||
def compress(self):
|
||||
try:
|
||||
|
||||
finalData = {}
|
||||
finalData['status'] = 1
|
||||
|
||||
|
||||
|
||||
if self.data['compressionType'] == 'zip':
|
||||
compressedFileName = self.returnPathEnclosed(self.data['basePath'] + '/' + self.data['compressedFileName'] + '.zip')
|
||||
command = 'sudo zip -r ' + compressedFileName + ' '
|
||||
else:
|
||||
compressedFileName = self.returnPathEnclosed(
|
||||
self.data['basePath'] + '/' + self.data['compressedFileName'] + '.tar.gz')
|
||||
command = 'sudo tar -czvf ' + compressedFileName + ' '
|
||||
|
||||
for item in self.data['listOfFiles']:
|
||||
command = command + self.returnPathEnclosed(self.data['basePath'] + '/' + item) + ' '
|
||||
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
self.changeOwner(self.data['compressedFileName'])
|
||||
|
||||
json_data = json.dumps(finalData)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
return self.ajaxPre(0, str(msg))
|
||||
@@ -63,7 +63,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
nodeForChilds = element.parentNode;
|
||||
funcCompletePath = completePath;
|
||||
}
|
||||
url = domainName + "/php/fileManager.php";
|
||||
url = '/filemanager/controller';
|
||||
|
||||
|
||||
var data = {
|
||||
@@ -81,7 +81,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
$scope.treeLoading = true;
|
||||
|
||||
|
||||
if (response.data.fetchStatus === 1) {
|
||||
if (response.data.status === 1) {
|
||||
|
||||
/// node prepration
|
||||
|
||||
@@ -93,7 +93,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
var keys = Object.keys(filesData);
|
||||
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
if (keys[i] === "error_message" | keys[i] === "fetchStatus") {
|
||||
if (keys[i] === "error_message" | keys[i] === "status") {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
@@ -620,7 +620,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
|
||||
allFilesAndFolders = [];
|
||||
$scope.buttonActivator();
|
||||
url = domainName + "/php/fileManager.php";
|
||||
url = "/filemanager/controller";
|
||||
var completePathToFile = "";
|
||||
|
||||
if (functionName === "startPoint") {
|
||||
@@ -666,7 +666,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
tableBody.innerHTML = '';
|
||||
|
||||
|
||||
if (response.data.fetchStatus === 1) {
|
||||
if (response.data.status === 1) {
|
||||
|
||||
|
||||
/// node prepration
|
||||
@@ -676,7 +676,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
var keys = Object.keys(filesData);
|
||||
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
if (keys[i] === "error_message" | keys[i] === "fetchStatus") {
|
||||
if (keys[i] === "error_message" | keys[i] === "status") {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
@@ -697,7 +697,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
}
|
||||
else {
|
||||
var notification = alertify.notify(response.data.error_message, 'error', 10, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
$scope.fetchForTableSecondary(null, 'homeFetch');
|
||||
}
|
||||
@@ -713,46 +712,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
return (/[.]/.exec(fileName)) ? /[^.]+$/.exec(fileName) : undefined;
|
||||
}
|
||||
|
||||
// Create entry point for domain
|
||||
|
||||
function createEntryPoint() {
|
||||
|
||||
url = "/filemanager/createTemporaryFile";
|
||||
|
||||
var data = {
|
||||
domainName: domainName
|
||||
};
|
||||
|
||||
var config = {};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if (response.data.createTemporaryFile === 1) {
|
||||
domainRandomSeed = response.data.domainRandomSeed;
|
||||
$scope.fetchForTableSecondary(null, "startPoint");
|
||||
}
|
||||
else {
|
||||
var notification = alertify.notify(response.data.error_message, 'error', 10, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
var notification = alertify.notify("Could not connec to server, refresh page.", 'error', 10, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
createEntryPoint();
|
||||
|
||||
|
||||
// html editor
|
||||
|
||||
$scope.getFileContents = function () {
|
||||
@@ -774,7 +733,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
|
||||
$scope.htmlEditorLoading = true;
|
||||
|
||||
if (response.data.fetchStatus === 1) {
|
||||
if (response.data.status === 1) {
|
||||
|
||||
var editor = ace.edit("htmlEditorContent");
|
||||
editor.setTheme("ace/theme/chrome");
|
||||
@@ -817,7 +776,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
|
||||
$scope.htmlEditorLoading = true;
|
||||
|
||||
if (response.data.saveStatus === 1) {
|
||||
if (response.data.status === 1) {
|
||||
$scope.htmlEditorLoading = true;
|
||||
$scope.saveSuccess = false;
|
||||
}
|
||||
@@ -839,7 +798,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
$scope.errorMessage = true;
|
||||
|
||||
var uploader = $scope.uploader = new FileUploader({
|
||||
url: domainName + "/php/caller.php",
|
||||
url: "/filemanager/upload",
|
||||
formData: [{
|
||||
"method": "upload",
|
||||
"home": homePathBack
|
||||
@@ -902,12 +861,12 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
domainName: domainName
|
||||
};
|
||||
|
||||
|
||||
var url = '/filemanager/controller';
|
||||
$http.post(url, data).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if (response.data.createStatus === 1) {
|
||||
if (response.data.status === 1) {
|
||||
$scope.createSuccess = false;
|
||||
$scope.fetchForTableSecondary(null, 'refresh');
|
||||
$('#showCreateFolder').modal('hide');
|
||||
@@ -959,7 +918,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if (response.data.createStatus === 1) {
|
||||
if (response.data.status === 1) {
|
||||
$scope.createSuccess = false;
|
||||
$scope.fetchForTableSecondary(null, 'refresh');
|
||||
$('#showCreateFile').modal('hide');
|
||||
@@ -1004,10 +963,9 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
$scope.deleteLoading = true;
|
||||
if (response.data.deleteStatus === 1) {
|
||||
if (response.data.status === 1) {
|
||||
$('#showDelete').modal('hide');
|
||||
var notification = alertify.notify('Successfully Deleted!', 'success', 5, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
$scope.fetchForTableSecondary(null, 'refresh');
|
||||
}
|
||||
@@ -1062,15 +1020,13 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
|
||||
$scope.compressionLoading = true;
|
||||
$('#showCompression').modal('hide');
|
||||
if (response.data.compressed === 1) {
|
||||
if (response.data.status === 1) {
|
||||
var notification = alertify.notify('Successfully Compressed!', 'success', 5, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
$scope.fetchForTableSecondary(null, 'refresh');
|
||||
}
|
||||
else {
|
||||
var notification = alertify.notify(response.data.error_message, 'error', 5, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1125,7 +1081,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
$scope.extractionLoading = true;
|
||||
$('#showExtraction').modal('hide');
|
||||
|
||||
if (response.data.extracted === 1) {
|
||||
if (response.data.status === 1) {
|
||||
var notification = alertify.notify('Successfully Extracted!', 'success', 5, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
@@ -1184,15 +1140,13 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
$scope.moveLoading = true;
|
||||
$('#showMove').modal('hide');
|
||||
|
||||
if (response.data.moved === 1) {
|
||||
if (response.data.status === 1) {
|
||||
var notification = alertify.notify('Successfully Moved!', 'success', 5, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
$scope.fetchForTableSecondary(null, 'refresh');
|
||||
}
|
||||
else {
|
||||
var notification = alertify.notify(response.data.error_message, 'error', 5, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1242,15 +1196,13 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
|
||||
$('#showCopy').modal('hide');
|
||||
|
||||
if (response.data.copied === 1) {
|
||||
if (response.data.status === 1) {
|
||||
var notification = alertify.notify('Successfully Copied!', 'success', 5, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
$scope.fetchForTableSecondary(null, 'refresh');
|
||||
}
|
||||
else {
|
||||
var notification = alertify.notify(response.data.error_message, 'error', 5, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1366,15 +1318,13 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
$('#showRename').modal('hide');
|
||||
$scope.renameLoading = true;
|
||||
|
||||
if (response.data.renamed === 1) {
|
||||
if (response.data.status === 1) {
|
||||
var notification = alertify.notify('Successfully Renamed!', 'success', 5, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
$scope.fetchForTableSecondary(null, 'refresh');
|
||||
}
|
||||
else {
|
||||
var notification = alertify.notify(response.data.error_message, 'error', 5, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1602,13 +1552,11 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
|
||||
if (response.data.permissionsChanged === 1) {
|
||||
var notification = alertify.notify('Permissions Successfully Changed!', 'success', 5, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
$scope.fetchForTableSecondary(null, 'refresh');
|
||||
}
|
||||
else {
|
||||
var notification = alertify.notify(response.data.error_message, 'error', 5, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,10 @@ from django.conf.urls import url
|
||||
import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^upload$',views.upload, name='upload'),
|
||||
url(r'^changePermissions$',views.changePermissions, name='changePermissions'),
|
||||
url(r'^controller$',views.controller, name='controller'),
|
||||
url(r'^downloadFile$',views.downloadFile, name='downloadFile'),
|
||||
url(r'^createTemporaryFile$',views.createTemporaryFile, name='createTemporaryFile'),
|
||||
url(r'^(?P<domain>(.*))$', views.loadFileManagerHome, name='loadFileManagerHome'),
|
||||
|
||||
]
|
||||
|
||||
@@ -13,6 +13,7 @@ import shlex
|
||||
import os
|
||||
from plogical.virtualHostUtilities import virtualHostUtilities
|
||||
from plogical.acl import ACLManager
|
||||
from .filemanager import FileManager as FM
|
||||
|
||||
# Create your views here.
|
||||
|
||||
@@ -34,7 +35,6 @@ def loadFileManagerHome(request,domain):
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def changePermissions(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
@@ -92,40 +92,71 @@ def downloadFile(request):
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def createTemporaryFile(request):
|
||||
def controller(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
data = json.loads(request.body)
|
||||
domainName = data['domainName']
|
||||
method = data['method']
|
||||
|
||||
userID = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if ACLManager.checkOwnership(domainName, admin, currentACL) == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('createTemporaryFile', 0)
|
||||
return ACLManager.loadErrorJson()
|
||||
|
||||
## Create file manager entry
|
||||
fm = FM(request, data)
|
||||
|
||||
if Websites.objects.filter(domain=domainName).exists():
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/filemanager.py"
|
||||
if method == 'listForTable':
|
||||
return fm.listForTable()
|
||||
elif method == 'list':
|
||||
return fm.list()
|
||||
elif method == 'createNewFile':
|
||||
return fm.createNewFile()
|
||||
elif method == 'createNewFolder':
|
||||
return fm.createNewFolder()
|
||||
elif method == 'deleteFolderOrFile':
|
||||
return fm.deleteFolderOrFile()
|
||||
elif method == 'copy':
|
||||
return fm.copy()
|
||||
elif method == 'move':
|
||||
return fm.move()
|
||||
elif method == 'rename':
|
||||
return fm.rename()
|
||||
elif method == 'readFileContents':
|
||||
return fm.readFileContents()
|
||||
elif method == 'writeFileContents':
|
||||
return fm.writeFileContents()
|
||||
elif method == 'upload':
|
||||
return fm.writeFileContents()
|
||||
elif method == 'extract':
|
||||
return fm.extract()
|
||||
elif method == 'compress':
|
||||
return fm.compress()
|
||||
|
||||
execPath = execPath + " createTemporaryFile --domainName " + domainName
|
||||
|
||||
output = subprocess.check_output(shlex.split(execPath))
|
||||
except BaseException, msg:
|
||||
fm = FM(request, None)
|
||||
return fm.ajaxPre(0, str(msg))
|
||||
|
||||
if output.find("0,") > -1:
|
||||
data_ret = {'createTemporaryFile': 0, 'error_message': "None"}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
def upload(request):
|
||||
try:
|
||||
|
||||
data = request.POST
|
||||
|
||||
userID = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if ACLManager.checkOwnership(data['domainName'], admin, currentACL) == 1:
|
||||
pass
|
||||
else:
|
||||
domainRandomSeed = output.rstrip('\n')
|
||||
data_ret = {'createTemporaryFile': 1, 'error_message': "None", 'domainRandomSeed': domainRandomSeed}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
return ACLManager.loadErrorJson()
|
||||
|
||||
fm = FM(request, data)
|
||||
return fm.upload()
|
||||
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
@@ -9,7 +9,7 @@ User=cyberpanel
|
||||
Group=cyberpanel
|
||||
RuntimeDirectory=gunicorn
|
||||
WorkingDirectory=/usr/local/CyberCP
|
||||
ExecStart=/usr/local/CyberCP/bin/gunicorn --pid /run/gunicorn/gucpid \
|
||||
ExecStart=/usr/local/CyberCP/bin/gunicorn --pid /run/gunicorn/gucpid --timeout 2000 --workers 2 \
|
||||
--bind 127.0.0.1:5003 CyberCP.wsgi
|
||||
ExecReload=/bin/kill -s HUP $MAINPID
|
||||
ExecStop=/bin/kill -s TERM $MAINPID
|
||||
|
||||
@@ -121,7 +121,7 @@ User=cyberpanel
|
||||
Group=cyberpanel
|
||||
RuntimeDirectory=gunicorn
|
||||
WorkingDirectory=/usr/local/CyberCP
|
||||
ExecStart=/usr/local/CyberCP/bin/gunicorn --pid /run/gunicorn/gucpid \
|
||||
ExecStart=/usr/local/CyberCP/bin/gunicorn --pid /run/gunicorn/gucpid --timeout 2000 --workers 2 \
|
||||
--bind 127.0.0.1:5003 CyberCP.wsgi
|
||||
ExecReload=/bin/kill -s HUP $MAINPID
|
||||
ExecStop=/bin/kill -s TERM $MAINPID
|
||||
@@ -697,6 +697,11 @@ WantedBy=multi-user.target"""
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
cursor.execute('ALTER TABLE dockerManager_containers ADD volumes longtext')
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
connection.close()
|
||||
except:
|
||||
@@ -838,6 +843,15 @@ WantedBy=multi-user.target"""
|
||||
else:
|
||||
writeToFile.writelines(items)
|
||||
|
||||
MEDIA_URL = 1
|
||||
for items in data:
|
||||
if items.find('MEDIA_URL') > -1:
|
||||
MEDIA_URL = 0
|
||||
|
||||
if MEDIA_URL == 1:
|
||||
writeToFile.writelines("MEDIA_URL = '/home/cyberpanel/media/'\n")
|
||||
writeToFile.writelines('MEDIA_ROOT = MEDIA_URL\n')
|
||||
|
||||
writeToFile.close()
|
||||
|
||||
Upgrade.stdOut('Settings file restored!')
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
app.controller('installDocker', function ($scope, $http, $timeout, $window) {
|
||||
$scope.installDockerStatus = true;
|
||||
$scope.installBoxGen = true;
|
||||
@@ -120,18 +118,27 @@ app.controller('runContainer', function ($scope, $http) {
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.goBackDisable = true;
|
||||
|
||||
$scope.volList = {};
|
||||
$scope.volListNumber = 0;
|
||||
$scope.addVolField = function () {
|
||||
$scope.volList[$scope.volListNumber] = {'dest': '', 'src': ''};
|
||||
$scope.volListNumber = $scope.volListNumber + 1;
|
||||
console.log($scope.volList)
|
||||
};
|
||||
$scope.removeVolField = function () {
|
||||
delete $scope.volList[$scope.volListNumber - 1];
|
||||
$scope.volListNumber = $scope.volListNumber - 1;
|
||||
};
|
||||
|
||||
$scope.addEnvField = function () {
|
||||
var countEnv = Object.keys($scope.envList).length;
|
||||
$scope.envList[countEnv + 1] = {'name': '', 'value': ''};
|
||||
}
|
||||
};
|
||||
|
||||
var statusFile;
|
||||
|
||||
$scope.createContainer = function () {
|
||||
|
||||
console.log($scope.iport);
|
||||
console.log($scope.portType);
|
||||
|
||||
$scope.containerCreationLoading = true;
|
||||
$scope.installationDetailsForm = true;
|
||||
$scope.installationProgress = false;
|
||||
@@ -157,7 +164,8 @@ app.controller('runContainer', function ($scope, $http) {
|
||||
memory: memory,
|
||||
dockerOwner: dockerOwner,
|
||||
image: image,
|
||||
envList: $scope.envList
|
||||
envList: $scope.envList,
|
||||
volList: $scope.volList
|
||||
|
||||
};
|
||||
|
||||
@@ -165,8 +173,6 @@ app.controller('runContainer', function ($scope, $http) {
|
||||
data[port + "/" + protocol] = $scope.eport[port];
|
||||
});
|
||||
|
||||
console.log(data)
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
@@ -314,7 +320,7 @@ app.controller('listContainers', function ($scope, $http) {
|
||||
if (response.data.delContainerStatus === 1) {
|
||||
location.reload();
|
||||
}
|
||||
else if (response.data.delContainerStatus == 2) {
|
||||
else if (response.data.delContainerStatus === 2) {
|
||||
(new PNotify({
|
||||
title: response.data.error_message,
|
||||
text: 'Delete anyway?',
|
||||
@@ -382,7 +388,6 @@ app.controller('listContainers', function ($scope, $http) {
|
||||
else {
|
||||
name = $scope.activeLog;
|
||||
}
|
||||
console.log(name)
|
||||
$scope.logs = "Loading...";
|
||||
|
||||
url = "/docker/getContainerLogs";
|
||||
@@ -420,7 +425,7 @@ app.controller('listContainers', function ($scope, $http) {
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
url = "/docker/getContainerList";
|
||||
|
||||
@@ -697,7 +702,16 @@ app.controller('viewContainer', function ($scope, $http) {
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
$scope.addVolField = function () {
|
||||
$scope.volList[$scope.volListNumber] = {'dest': '', 'src': ''};
|
||||
$scope.volListNumber = $scope.volListNumber + 1;
|
||||
};
|
||||
$scope.removeVolField = function () {
|
||||
delete $scope.volList[$scope.volListNumber - 1];
|
||||
$scope.volListNumber = $scope.volListNumber - 1;
|
||||
};
|
||||
|
||||
$scope.saveSettings = function () {
|
||||
$('#containerSettingLoading').show();
|
||||
@@ -709,10 +723,11 @@ app.controller('viewContainer', function ($scope, $http) {
|
||||
memory: $scope.memory,
|
||||
startOnReboot: $scope.startOnReboot,
|
||||
envConfirmation: $scope.envConfirmation,
|
||||
envList: $scope.envList
|
||||
envList: $scope.envList,
|
||||
volList: $scope.volList
|
||||
};
|
||||
|
||||
console.log(data)
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
|
||||
@@ -63,7 +63,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
nodeForChilds = element.parentNode;
|
||||
funcCompletePath = completePath;
|
||||
}
|
||||
url = domainName + "/php/fileManager.php";
|
||||
url = '/filemanager/controller';
|
||||
|
||||
|
||||
var data = {
|
||||
@@ -81,7 +81,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
$scope.treeLoading = true;
|
||||
|
||||
|
||||
if (response.data.fetchStatus === 1) {
|
||||
if (response.data.status === 1) {
|
||||
|
||||
/// node prepration
|
||||
|
||||
@@ -93,7 +93,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
var keys = Object.keys(filesData);
|
||||
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
if (keys[i] === "error_message" | keys[i] === "fetchStatus") {
|
||||
if (keys[i] === "error_message" | keys[i] === "status") {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
@@ -620,7 +620,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
|
||||
allFilesAndFolders = [];
|
||||
$scope.buttonActivator();
|
||||
url = domainName + "/php/fileManager.php";
|
||||
url = "/filemanager/controller";
|
||||
var completePathToFile = "";
|
||||
|
||||
if (functionName === "startPoint") {
|
||||
@@ -666,7 +666,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
tableBody.innerHTML = '';
|
||||
|
||||
|
||||
if (response.data.fetchStatus === 1) {
|
||||
if (response.data.status === 1) {
|
||||
|
||||
|
||||
/// node prepration
|
||||
@@ -676,7 +676,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
var keys = Object.keys(filesData);
|
||||
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
if (keys[i] === "error_message" | keys[i] === "fetchStatus") {
|
||||
if (keys[i] === "error_message" | keys[i] === "status") {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
@@ -697,7 +697,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
}
|
||||
else {
|
||||
var notification = alertify.notify(response.data.error_message, 'error', 10, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
$scope.fetchForTableSecondary(null, 'homeFetch');
|
||||
}
|
||||
@@ -713,46 +712,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
return (/[.]/.exec(fileName)) ? /[^.]+$/.exec(fileName) : undefined;
|
||||
}
|
||||
|
||||
// Create entry point for domain
|
||||
|
||||
function createEntryPoint() {
|
||||
|
||||
url = "/filemanager/createTemporaryFile";
|
||||
|
||||
var data = {
|
||||
domainName: domainName
|
||||
};
|
||||
|
||||
var config = {};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if (response.data.createTemporaryFile === 1) {
|
||||
domainRandomSeed = response.data.domainRandomSeed;
|
||||
$scope.fetchForTableSecondary(null, "startPoint");
|
||||
}
|
||||
else {
|
||||
var notification = alertify.notify(response.data.error_message, 'error', 10, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
var notification = alertify.notify("Could not connec to server, refresh page.", 'error', 10, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
createEntryPoint();
|
||||
|
||||
|
||||
// html editor
|
||||
|
||||
$scope.getFileContents = function () {
|
||||
@@ -774,7 +733,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
|
||||
$scope.htmlEditorLoading = true;
|
||||
|
||||
if (response.data.fetchStatus === 1) {
|
||||
if (response.data.status === 1) {
|
||||
|
||||
var editor = ace.edit("htmlEditorContent");
|
||||
editor.setTheme("ace/theme/chrome");
|
||||
@@ -817,7 +776,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
|
||||
$scope.htmlEditorLoading = true;
|
||||
|
||||
if (response.data.saveStatus === 1) {
|
||||
if (response.data.status === 1) {
|
||||
$scope.htmlEditorLoading = true;
|
||||
$scope.saveSuccess = false;
|
||||
}
|
||||
@@ -839,7 +798,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
$scope.errorMessage = true;
|
||||
|
||||
var uploader = $scope.uploader = new FileUploader({
|
||||
url: domainName + "/php/caller.php",
|
||||
url: "/filemanager/upload",
|
||||
formData: [{
|
||||
"method": "upload",
|
||||
"home": homePathBack
|
||||
@@ -902,12 +861,12 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
domainName: domainName
|
||||
};
|
||||
|
||||
|
||||
var url = '/filemanager/controller';
|
||||
$http.post(url, data).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if (response.data.createStatus === 1) {
|
||||
if (response.data.status === 1) {
|
||||
$scope.createSuccess = false;
|
||||
$scope.fetchForTableSecondary(null, 'refresh');
|
||||
$('#showCreateFolder').modal('hide');
|
||||
@@ -959,7 +918,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if (response.data.createStatus === 1) {
|
||||
if (response.data.status === 1) {
|
||||
$scope.createSuccess = false;
|
||||
$scope.fetchForTableSecondary(null, 'refresh');
|
||||
$('#showCreateFile').modal('hide');
|
||||
@@ -1004,10 +963,9 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
$scope.deleteLoading = true;
|
||||
if (response.data.deleteStatus === 1) {
|
||||
if (response.data.status === 1) {
|
||||
$('#showDelete').modal('hide');
|
||||
var notification = alertify.notify('Successfully Deleted!', 'success', 5, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
$scope.fetchForTableSecondary(null, 'refresh');
|
||||
}
|
||||
@@ -1062,15 +1020,13 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
|
||||
$scope.compressionLoading = true;
|
||||
$('#showCompression').modal('hide');
|
||||
if (response.data.compressed === 1) {
|
||||
if (response.data.status === 1) {
|
||||
var notification = alertify.notify('Successfully Compressed!', 'success', 5, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
$scope.fetchForTableSecondary(null, 'refresh');
|
||||
}
|
||||
else {
|
||||
var notification = alertify.notify(response.data.error_message, 'error', 5, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1125,7 +1081,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
$scope.extractionLoading = true;
|
||||
$('#showExtraction').modal('hide');
|
||||
|
||||
if (response.data.extracted === 1) {
|
||||
if (response.data.status === 1) {
|
||||
var notification = alertify.notify('Successfully Extracted!', 'success', 5, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
@@ -1184,15 +1140,13 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
$scope.moveLoading = true;
|
||||
$('#showMove').modal('hide');
|
||||
|
||||
if (response.data.moved === 1) {
|
||||
if (response.data.status === 1) {
|
||||
var notification = alertify.notify('Successfully Moved!', 'success', 5, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
$scope.fetchForTableSecondary(null, 'refresh');
|
||||
}
|
||||
else {
|
||||
var notification = alertify.notify(response.data.error_message, 'error', 5, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1242,15 +1196,13 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
|
||||
$('#showCopy').modal('hide');
|
||||
|
||||
if (response.data.copied === 1) {
|
||||
if (response.data.status === 1) {
|
||||
var notification = alertify.notify('Successfully Copied!', 'success', 5, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
$scope.fetchForTableSecondary(null, 'refresh');
|
||||
}
|
||||
else {
|
||||
var notification = alertify.notify(response.data.error_message, 'error', 5, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1366,15 +1318,13 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
$('#showRename').modal('hide');
|
||||
$scope.renameLoading = true;
|
||||
|
||||
if (response.data.renamed === 1) {
|
||||
if (response.data.status === 1) {
|
||||
var notification = alertify.notify('Successfully Renamed!', 'success', 5, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
$scope.fetchForTableSecondary(null, 'refresh');
|
||||
}
|
||||
else {
|
||||
var notification = alertify.notify(response.data.error_message, 'error', 5, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1602,13 +1552,11 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
||||
|
||||
if (response.data.permissionsChanged === 1) {
|
||||
var notification = alertify.notify('Permissions Successfully Changed!', 'success', 5, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
$scope.fetchForTableSecondary(null, 'refresh');
|
||||
}
|
||||
else {
|
||||
var notification = alertify.notify(response.data.error_message, 'error', 5, function () {
|
||||
console.log('dismissed');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ from loginSystem.models import Administrator
|
||||
|
||||
|
||||
class Websites(models.Model):
|
||||
admin = models.ForeignKey(Administrator)
|
||||
package = models.ForeignKey(Package)
|
||||
admin = models.ForeignKey(Administrator, on_delete=models.PROTECT)
|
||||
package = models.ForeignKey(Package, on_delete=models.PROTECT)
|
||||
domain = models.CharField(max_length=50,unique=True)
|
||||
adminEmail = models.CharField(max_length=50)
|
||||
phpSelection = models.CharField(max_length=10)
|
||||
|
||||
Reference in New Issue
Block a user