remove filemanager.py

This commit is contained in:
Usman Nasir
2020-04-06 19:08:41 +05:00
parent c2a54f0990
commit 0af72a903c
4 changed files with 24 additions and 53 deletions

View File

@@ -5,7 +5,6 @@ from plogical.processUtilities import ProcessUtilities
from websiteFunctions.models import Websites from websiteFunctions.models import Websites
from random import randint from random import randint
from django.core.files.storage import FileSystemStorage from django.core.files.storage import FileSystemStorage
import html.parser
from plogical.acl import ACLManager from plogical.acl import ACLManager
class FileManager: class FileManager:
@@ -522,4 +521,17 @@ class FileManager:
ProcessUtilities.executioner(command) ProcessUtilities.executioner(command)
command = 'chmod 750 /home/%s/public_html' % (domainName) command = 'chmod 750 /home/%s/public_html' % (domainName)
ProcessUtilities.executioner(command) ProcessUtilities.executioner(command)
for childs in website.childdomains_set.all():
command = 'chown -R %s:%s %s/*' % (externalApp, externalApp, childs.path)
ProcessUtilities.popenExecutioner(command)
command = 'chown -R %s:%s %s/.[^.]*' % (externalApp, externalApp, childs.path)
ProcessUtilities.popenExecutioner(command)
command = 'chmod 750 %s' % (childs.path)
ProcessUtilities.popenExecutioner(command)
command = 'chmod %s:%s %s' % (externalApp, groupName, childs.path)
ProcessUtilities.popenExecutioner(command)

View File

@@ -886,18 +886,12 @@ class backupUtilities:
installUtilities.reStartLiteSpeed() installUtilities.reStartLiteSpeed()
if ProcessUtilities.decideDistro() == ProcessUtilities.centos: ## Fix permissions
groupName = 'nobody'
else:
groupName = 'nogroup'
command = "chown -R " + externalApp + ":%s " % (groupName) + websiteHome from filemanager.filemanager import FileManager
cmd = shlex.split(command)
subprocess.call(cmd)
command = 'chmod 750 %s' % (websiteHome) fm = FileManager(None, None)
cmd = shlex.split(command) fm.fixPermissions(masterDomain)
subprocess.call(cmd)
except BaseException as msg: except BaseException as msg:
status = os.path.join(completPath, 'status') status = os.path.join(completPath, 'status')

View File

@@ -1,40 +0,0 @@
from plogical import CyberCPLogFileWriter as logging
import argparse
from random import randint
class filemanager:
@staticmethod
def createTemporaryFile(domainName):
try:
path = "/home/" + domainName + "/..filemanagerkey"
fileKey = str(randint(1000, 9999))
filemanager = open(path,'w')
filemanager.write(fileKey)
filemanager.close()
print(fileKey)
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(
str(msg) + " [createTemporaryFile]")
print("0," + str(msg))
def main():
parser = argparse.ArgumentParser(description='CyberPanel Filemanager')
parser.add_argument('function', help='Specific a function to call!')
parser.add_argument('--domainName', help='Domain name!')
args = parser.parse_args()
if args.function == "createTemporaryFile":
filemanager.createTemporaryFile(args.domainName)
if __name__ == "__main__":
main()

View File

@@ -263,12 +263,17 @@ class ProcessUtilities(multi.Thread):
def customPoen(self): def customPoen(self):
try: try:
if type(self.extraArgs['command']) == str or type(self.extraArgs['command']) == bytes: if type(self.extraArgs['command']) == str or type(self.extraArgs['command']) == bytes:
command = self.extraArgs['command'] command = self.extraArgs['command']
else: else:
command = " ".join(self.extraArgs['command']) command = " ".join(self.extraArgs['command'])
ProcessUtilities.sendCommand(command, self.extraArgs['user']) if getpass.getuser() == 'root':
subprocess.call(command, shell=True)
else:
ProcessUtilities.sendCommand(command, self.extraArgs['user'])
return 1 return 1
except BaseException as msg: except BaseException as msg: