Exemple #1
0
def restoreRemoteBackups(request):
    try:
        userID = request.session['userID']
        currentACL = ACLManager.loadedACL(userID)

        if ACLManager.currentContextPermission(currentACL,
                                               'createBackup') == 0:
            return ACLManager.loadError()

        websitesName = ACLManager.findAllSites(currentACL, userID)

        destinations = []

        path = '/home/cyberpanel/sftp'

        if os.path.exists(path):
            for items in os.listdir(path):
                destinations.append('sftp:%s' % (items))

        path = '/home/cyberpanel/aws'
        if os.path.exists(path):
            for items in os.listdir(path):
                destinations.append('s3:s3.amazonaws.com/%s' % (items))

        return defRenderer(request, 'IncBackups/restoreRemoteBackups.html', {
            'websiteList': websitesName,
            'destinations': destinations
        })
    except BaseException, msg:
        logging.writeToFile(str(msg))
        return redirect(loadLoginPage)
Exemple #2
0
def createFTPAccount(sender, **kwargs):
    from loginSystem.models import Administrator
    from plogical.acl import ACLManager
    try:
        request = kwargs['request']
        userID = request.session['userID']
        currentACL = ACLManager.loadedACL(userID)

        if ACLManager.currentContextPermission(currentACL,
                                               'createFTPAccount') == 0:
            return ACLManager.loadError()

        admin = Administrator.objects.get(pk=userID)

        if not os.path.exists('/home/cyberpanel/pureftpd'):
            return render(request, "ftp/createFTPAccount.html", {"status": 0})

        websitesName = ACLManager.findAllSites(currentACL, userID)

        return render(request, 'beautifulNames/createFTPAccount.html', {
            'websiteList': websitesName,
            'admin': admin.userName,
            "status": 1
        })
    except BaseException, msg:
        return HttpResponse(str(msg))
Exemple #3
0
    def backupSite(self, request = None, userID = None, data = None):
        try:
            currentACL = ACLManager.loadedACL(userID)

            if ACLManager.currentContextPermission(currentACL, 'createBackup') == 0:
                return ACLManager.loadError()

            websitesName = ACLManager.findAllSites(currentACL, userID)
            return render(request, 'backup/backup.html', {'websiteList': websitesName})
        except BaseException, msg:
            return HttpResponse(str(msg))
Exemple #4
0
    def listDBs(self, request=None, userID=None):
        try:
            currentACL = ACLManager.loadedACL(userID)
            if ACLManager.currentContextPermission(currentACL,
                                                   'listDatabases') == 0:
                return ACLManager.loadError()

            websitesName = ACLManager.findAllSites(currentACL, userID)

            return render(request, 'databases/listDataBases.html',
                          {'websiteList': websitesName})
        except BaseException, msg:
            return HttpResponse(str(msg))
Exemple #5
0
    def deleteDatabase(self, request=None, userID=None):
        try:

            currentACL = ACLManager.loadedACL(userID)
            if ACLManager.currentContextPermission(currentACL,
                                                   'deleteDatabase') == 0:
                return ACLManager.loadError()

            websitesName = ACLManager.findAllSites(currentACL, userID)

            return render(request, 'databases/deleteDatabase.html',
                          {'websitesList': websitesName})
        except BaseException, msg:
            logging.CyberCPLogFileWriter.writeToFile(str(msg))
            return HttpResponse(str(msg))
Exemple #6
0
def createDatabase(sender, **kwargs):
    from plogical.acl import ACLManager
    try:
        request = kwargs['request']
        userID = request.session['userID']

        currentACL = ACLManager.loadedACL(userID)
        if ACLManager.currentContextPermission(currentACL,
                                               'createDatabase') == 0:
            return ACLManager.loadError()

        websitesName = ACLManager.findAllSites(currentACL, userID)

        return render(request, 'beautifulNames/createDatabase.html',
                      {'websitesList': websitesName})
    except BaseException, msg:
        return HttpResponse(str(msg))
Exemple #7
0
    def listFTPAccounts(self):
        try:
            userID = self.request.session['userID']
            currentACL = ACLManager.loadedACL(userID)

            if ACLManager.currentContextPermission(currentACL, 'listFTPAccounts') == 0:
                return ACLManager.loadError()

            if not os.path.exists('/home/cyberpanel/pureftpd'):
                return render(self.request, "ftp/listFTPAccounts.html", {"status": 0})

            websitesName = ACLManager.findAllSites(currentACL, userID)

            return render(self.request, 'ftp/listFTPAccounts.html', {'websiteList': websitesName, "status": 1})
        except BaseException, msg:
            logging.CyberCPLogFileWriter.writeToFile(str(msg))
            return HttpResponse(str(msg))
    def emailForwarding(self):
        try:
            userID = self.request.session['userID']
            currentACL = ACLManager.loadedACL(userID)

            if ACLManager.currentContextPermission(currentACL, 'emailForwarding') == 0:
                return ACLManager.loadError()

            if not os.path.exists('/home/cyberpanel/postfix'):
                return render(self.request, "mailServer/emailForwarding.html", {"status": 0})

            websitesName = ACLManager.findAllSites(currentACL, userID)
            websitesName = websitesName + ACLManager.findChildDomains(websitesName)

            return render(self.request, 'mailServer/emailForwarding.html', {'websiteList': websitesName, "status": 1})
        except BaseException, msg:
            return redirect(loadLoginPage)
Exemple #9
0
    def websitePagination(self, currentACL, userID):
        websites = ACLManager.findAllSites(currentACL, userID)

        pages = float(len(websites)) / float(10)
        pagination = []

        if pages <= 1.0:
            pages = 1
            pagination.append('<li><a href="\#"></a></li>')
        else:
            pages = ceil(pages)
            finalPages = int(pages) + 1

            for i in range(1, finalPages):
                pagination.append('<li><a href="\#">' + str(i) + '</a></li>')

        return pagination
Exemple #10
0
    def dkimManager(self):
        try:
            userID = self.request.session['userID']
            currentACL = ACLManager.loadedACL(userID)

            if ACLManager.currentContextPermission(currentACL, 'dkimManager') == 0:
                return ACLManager.loadError()

            openDKIMInstalled = 1

            websitesName = ACLManager.findAllSites(currentACL, userID)
            websitesName = websitesName + ACLManager.findChildDomains(websitesName)

            return render(self.request, 'mailServer/dkimManager.html',
                          {'websiteList': websitesName, 'openDKIMInstalled': openDKIMInstalled})

        except BaseException, msg:
            return redirect(loadLoginPage)
Exemple #11
0
def manageSSL(request):
    try:
        userID = request.session['userID']
        currentACL = ACLManager.loadedACL(userID)

        if currentACL['admin'] == 1:
            pass
        elif currentACL['manageSSL'] == 1:
            pass
        else:
            return ACLManager.loadError()

        websitesName = ACLManager.findAllSites(currentACL, userID)

        return render(request, 'manageSSL/manageSSL.html',
                      {'websiteList': websitesName})
    except KeyError:
        return redirect(loadLoginPage)
Exemple #12
0
    def phpTuning(self, request, userID):
        try:
            userID = request.session['userID']
            currentACL = ACLManager.loadedACL(userID)

            if currentACL['admin'] == 1:
                pass
            else:
                return ACLManager.loadError()

            if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
                websitesName = ACLManager.findAllSites(currentACL, userID)
                OLS = 1
                return render(request, 'tuning/phpTuning.html', {
                    'websiteList': websitesName,
                    'OLS': OLS
                })
            else:
                OLS = 0
                return render(request, 'tuning/phpTuning.html', {'OLS': OLS})

        except KeyError:
            return redirect(loadLoginPage)