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 random import randint
from django.core.files.storage import FileSystemStorage
import html.parser
from plogical.acl import ACLManager
class FileManager:
@@ -523,3 +522,16 @@ class FileManager:
command = 'chmod 750 /home/%s/public_html' % (domainName)
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()
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
groupName = 'nobody'
else:
groupName = 'nogroup'
## Fix permissions
command = "chown -R " + externalApp + ":%s " % (groupName) + websiteHome
cmd = shlex.split(command)
subprocess.call(cmd)
from filemanager.filemanager import FileManager
command = 'chmod 750 %s' % (websiteHome)
cmd = shlex.split(command)
subprocess.call(cmd)
fm = FileManager(None, None)
fm.fixPermissions(masterDomain)
except BaseException as msg:
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,11 +263,16 @@ class ProcessUtilities(multi.Thread):
def customPoen(self):
try:
if type(self.extraArgs['command']) == str or type(self.extraArgs['command']) == bytes:
command = self.extraArgs['command']
else:
command = " ".join(self.extraArgs['command'])
if getpass.getuser() == 'root':
subprocess.call(command, shell=True)
else:
ProcessUtilities.sendCommand(command, self.extraArgs['user'])
return 1