diff --git a/dockerManager/urls.py b/dockerManager/urls.py index 64209963e..bf1bf02a5 100755 --- a/dockerManager/urls.py +++ b/dockerManager/urls.py @@ -1,5 +1,8 @@ from django.conf.urls import url +from django.urls import path + from . import views +from websiteFunctions.views import Dockersitehome urlpatterns = [ url(r'^$', views.loadDockerHome, name='dockerHome'), @@ -26,4 +29,6 @@ url(r'^installDocker', views.installDocker, name='installDocker'), url(r'^images', views.images, name='containerImage'), url(r'^view/(?P(.*))$', views.viewContainer, name='viewContainer'), + + path('manage//app', Dockersitehome, name='Dockersitehome'), ] \ No newline at end of file diff --git a/plogical/DockerSites.py b/plogical/DockerSites.py index cf618961b..3e6cbac99 100644 --- a/plogical/DockerSites.py +++ b/plogical/DockerSites.py @@ -97,9 +97,6 @@ def SetupHTAccess(port, htaccess): WriteToFile.write(HTAccessContent) WriteToFile.close() - from plogical.installUtilities import installUtilities - installUtilities.reStartLiteSpeed() - # Takes # ComposePath, MySQLPath, MySQLRootPass, MySQLDBName, MySQLDBNUser, MySQLPassword, CPUsMySQL, MemoryMySQL, # port, SitePath, CPUsSite, MemorySite, ComposePath, SiteName @@ -336,6 +333,11 @@ def DeployWPContainer(self): command = f"chown -R nobody:{group} /home/docker/{self.data['finalURL']}/data" ProcessUtilities.executioner(command) + ### just restart ls for htaccess + + from plogical.installUtilities import installUtilities + installUtilities.reStartLiteSpeed() + logging.statusWriter(self.JobID, 'Completed. [200]') # command = f"docker-compose -f {self.data['ComposePath']} ps -q wordpress" @@ -592,6 +594,7 @@ def ContainerLogs(self): return 0, str(msg) ### pass container id and number of lines to fetch from logs + def ContainerInfo(self): try: import docker diff --git a/plogical/acl.py b/plogical/acl.py index f3507513c..1ab721c09 100644 --- a/plogical/acl.py +++ b/plogical/acl.py @@ -739,7 +739,6 @@ def checkGDriveOwnership(gD, admin, currentACL): except: return 0 - @staticmethod def checkOwnershipZone(domain, admin, currentACL): try: @@ -1086,3 +1085,4 @@ def ReplaceDocRootApache(vhostConf, domainName, NewDocRoot): pass + diff --git a/websiteFunctions/templates/websiteFunctions/DockerSiteHome.html b/websiteFunctions/templates/websiteFunctions/DockerSiteHome.html index d9c5cae2e..a827f89d2 100644 --- a/websiteFunctions/templates/websiteFunctions/DockerSiteHome.html +++ b/websiteFunctions/templates/websiteFunctions/DockerSiteHome.html @@ -14,5 +14,6 @@

Docker Site Home

+

{{ dockerSite.SiteName }}

{% endblock %} diff --git a/websiteFunctions/templates/websiteFunctions/ListDockersite.html b/websiteFunctions/templates/websiteFunctions/ListDockersite.html index ee4a2df2c..ec00ad49b 100644 --- a/websiteFunctions/templates/websiteFunctions/ListDockersite.html +++ b/websiteFunctions/templates/websiteFunctions/ListDockersite.html @@ -68,7 +68,7 @@

{% trans "File Manager" %}
- + {% trans "Manage" %} diff --git a/websiteFunctions/urls.py b/websiteFunctions/urls.py index ce3e04503..2173e983a 100755 --- a/websiteFunctions/urls.py +++ b/websiteFunctions/urls.py @@ -199,7 +199,7 @@ url(r'^submitDockerSiteCreation$', views.submitDockerSiteCreation, name='submitDockerSiteCreation'), url(r'^ListDockerSites$', views.ListDockerSites, name='ListDockerSites'), url(r'^fetchDockersite$', views.fetchDockersite, name='fetchDockersite'), - url(r'^(?P(.*))/Dockersitehome', views.Dockersitehome, name='Dockersitehome'), + ### SSH Configs diff --git a/websiteFunctions/views.py b/websiteFunctions/views.py index 6b1a21b62..5904d23d0 100755 --- a/websiteFunctions/views.py +++ b/websiteFunctions/views.py @@ -1846,10 +1846,10 @@ def fetchDockersite(request): except KeyError: return redirect(loadLoginPage) -def Dockersitehome(request, domain): +def Dockersitehome(request, dockerapp): try: userID = request.session['userID'] - wm = WebsiteManager(domain) + wm = WebsiteManager(dockerapp) return wm.Dockersitehome(request, userID, None) except KeyError: return redirect(loadLoginPage) \ No newline at end of file diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index 294566755..66e06cf47 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -6608,6 +6608,13 @@ def saveApacheConfigsToFile(self, userID=None, data=None): def CreateDockerPackage(self, request=None, userID=None, data=None, DeleteID=None): Data = {} + currentACL = ACLManager.loadedACL(userID) + + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadError() + try: if DeleteID != None: DockerPackagesDelete = DockerPackages.objects.get(pk=DeleteID) @@ -6623,6 +6630,13 @@ def CreateDockerPackage(self, request=None, userID=None, data=None, DeleteID=Non def AssignPackage(self, request=None, userID=None, data=None, DeleteID=None): + currentACL = ACLManager.loadedACL(userID) + + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadError() + try: if DeleteID != None: DockerPackagesDelete = PackageAssignment.objects.get(pk=DeleteID) @@ -6647,6 +6661,13 @@ def CreateDockersite(self, request=None, userID=None, data=None): def AddDockerpackage(self, userID=None, data=None): try: + currentACL = ACLManager.loadedACL(userID) + + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadError() + admin = Administrator.objects.get(pk=userID) name = data['name'] @@ -6668,6 +6689,13 @@ def AddDockerpackage(self, userID=None, data=None): def Getpackage(self, userID=None, data=None): try: + currentACL = ACLManager.loadedACL(userID) + + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadError() + admin = Administrator.objects.get(pk=userID) id = data['id'] @@ -6694,6 +6722,14 @@ def Getpackage(self, userID=None, data=None): def Updatepackage(self, userID=None, data=None): try: + + currentACL = ACLManager.loadedACL(userID) + + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadError() + admin = Administrator.objects.get(pk=userID) id = data['id'] CPU = data['CPU'] @@ -6720,6 +6756,15 @@ def Updatepackage(self, userID=None, data=None): def AddAssignment(self, userID=None, data=None): try: + + currentACL = ACLManager.loadedACL(userID) + + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadError() + + admin = Administrator.objects.get(pk=userID) package = data['package'] @@ -6845,11 +6890,19 @@ def submitDockerSiteCreation(self, userID=None, data=None): return HttpResponse(final_json) def ListDockerSites(self, request=None, userID=None, data=None, DeleteID=None): + admin = Administrator.objects.get(pk=userID) currentACL = ACLManager.loadedACL(userID) fdata={} + try: if DeleteID != None: + DockerSitesDelete = DockerSites.objects.get(pk=DeleteID) + if ACLManager.checkOwnership(DockerSitesDelete.admin, admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() + passdata={} passdata["domain"] = DockerSitesDelete.admin.domain passdata["JobID"] = None @@ -6875,21 +6928,13 @@ def fetchDockersite(self, userID=None, data=None): recordsToShow = int(data['recordsToShow']) - endPageNumber, finalPageNumber = self.recordsPointer(pageNumber, recordsToShow) - - dockersites = ACLManager.findDockersiteObjects(currentACL, userID) - - - pagination = self.getPagination(len(dockersites), recordsToShow) - logging.CyberCPLogFileWriter.writeToFile("Our dockersite" + str(dockersites)) - json_data = self.findDockersitesListJson(dockersites[finalPageNumber:endPageNumber]) @@ -6904,13 +6949,17 @@ def fetchDockersite(self, userID=None, data=None): return HttpResponse(final_json) def Dockersitehome(self, request=None, userID=None, data=None, DeleteID=None): + currentACL = ACLManager.loadedACL(userID) admin = Administrator.objects.get(pk=userID) - if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1: + + ds = DockerSites.objects.get(pk=self.domain) + + if ACLManager.checkOwnership(ds.admin.domain, admin, currentACL) == 1: pass else: return ACLManager.loadError() proc = httpProc(request, 'websiteFunctions/DockerSiteHome.html', - None) + {'dockerSite': ds}) return proc.render()