git manager initial

This commit is contained in:
Usman Nasir
2020-03-07 19:01:54 +05:00
parent acdcfcb797
commit 2dc5ecd361
8 changed files with 148 additions and 31 deletions

View File

@@ -44,35 +44,13 @@ def changePermissions(request):
else:
return ACLManager.loadErrorJson('permissionsChanged', 0)
website = Websites.objects.get(domain=domainName)
externalApp = website.externalApp
command = 'chown -R %s:%s /home/%s/public_html/*' % (externalApp, externalApp, domainName)
ProcessUtilities.popenExecutioner(command)
command = 'chown -R %s:%s /home/%s/public_html/.[^.]*' % (externalApp, externalApp, domainName)
ProcessUtilities.popenExecutioner(command)
command = "chown root:nobody /home/" + domainName+"/logs"
ProcessUtilities.popenExecutioner(command)
command = "find %s -type d -exec chmod 0755 {} \;" % ("/home/" + domainName + "/public_html")
ProcessUtilities.popenExecutioner(command)
command = "find %s -type f -exec chmod 0644 {} \;" % ("/home/" + domainName + "/public_html")
ProcessUtilities.popenExecutioner(command)
command = 'chown %s:nobody /home/%s/public_html' % (externalApp, domainName)
ProcessUtilities.executioner(command)
command = 'chmod 750 /home/%s/public_html' % (domainName)
ProcessUtilities.executioner(command)
fm = FM(request, data)
fm.fixPermissions(domainName)
data_ret = {'permissionsChanged': 1, 'error_message': "None"}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg))
data_ret = {'permissionsChanged': 0, 'error_message': str(msg)}