mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 13:56:01 +01:00
remove filemanager.py
This commit is contained in:
@@ -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:
|
||||||
@@ -523,3 +522,16 @@ class FileManager:
|
|||||||
|
|
||||||
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)
|
||||||
@@ -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')
|
||||||
|
|||||||
@@ -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()
|
|
||||||
@@ -263,11 +263,16 @@ 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'])
|
||||||
|
|
||||||
|
if getpass.getuser() == 'root':
|
||||||
|
subprocess.call(command, shell=True)
|
||||||
|
else:
|
||||||
ProcessUtilities.sendCommand(command, self.extraArgs['user'])
|
ProcessUtilities.sendCommand(command, self.extraArgs['user'])
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
Reference in New Issue
Block a user