diff --git a/baseTemplate/templates/baseTemplate/FileManager.html b/baseTemplate/templates/baseTemplate/FileManager.html
index 12f387f07..f373e2cd5 100644
--- a/baseTemplate/templates/baseTemplate/FileManager.html
+++ b/baseTemplate/templates/baseTemplate/FileManager.html
@@ -633,7 +633,9 @@
diff --git a/baseTemplate/templates/baseTemplate/index.html b/baseTemplate/templates/baseTemplate/index.html
index 57282e9af..b84d941e8 100755
--- a/baseTemplate/templates/baseTemplate/index.html
+++ b/baseTemplate/templates/baseTemplate/index.html
@@ -737,10 +737,10 @@
-
+
- {% trans "FileManager" %}
+ {% trans "Root File Manager" %}
diff --git a/filemanager/static/filemanager/js/fileManager.js b/filemanager/static/filemanager/js/fileManager.js
index 716ef3bde..0f41ae271 100755
--- a/filemanager/static/filemanager/js/fileManager.js
+++ b/filemanager/static/filemanager/js/fileManager.js
@@ -1588,6 +1588,12 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
window.location.href = url + '?domainName=' + domainName + '&fileToDownload=' + downloadURL;
};
+ $scope.RootDownloadFile = function () {
+ url = "/filemanager/RootDownloadFile";
+ var downloadURL = $scope.currentPath + "/" + allFilesAndFolders[0];
+ window.location.href = url + '?fileToDownload=' + downloadURL;
+ };
+
// Change permissions
diff --git a/filemanager/urls.py b/filemanager/urls.py
index 20811bc04..bd58d4934 100755
--- a/filemanager/urls.py
+++ b/filemanager/urls.py
@@ -6,6 +6,7 @@ urlpatterns = [
url(r'^changePermissions$',views.changePermissions, name='changePermissions'),
url(r'^controller$',views.controller, name='controller'),
url(r'^downloadFile$',views.downloadFile, name='downloadFile'),
+ url(r'^RootDownloadFile$',views.RootDownloadFile, name='RootDownloadFile'),
url(r'^editFile$', views.editFile, name='editFile'),
url('^Filemanager', views.FileManagerRoot, name='Filemanager'),
url(r'^(?P(.*))$', views.loadFileManagerHome, name='loadFileManagerHome'),
diff --git a/filemanager/views.py b/filemanager/views.py
index 449d34156..67f25c66f 100755
--- a/filemanager/views.py
+++ b/filemanager/views.py
@@ -58,39 +58,6 @@ def changePermissions(request):
except KeyError:
return redirect(loadLoginPage)
-def downloadFile(request):
- try:
- userID = request.session['userID']
- admin = Administrator.objects.get(pk=userID)
- from urllib.parse import quote
- from django.utils.encoding import iri_to_uri
-
- fileToDownload = request.build_absolute_uri().split('fileToDownload')[1][1:]
- fileToDownload = iri_to_uri(fileToDownload)
-
- domainName = request.GET.get('domainName')
-
- currentACL = ACLManager.loadedACL(userID)
-
- if ACLManager.checkOwnership(domainName, admin, currentACL) == 1:
- pass
- else:
- return ACLManager.loadErrorJson('permissionsChanged', 0)
-
- homePath = '/home/%s' % (domainName)
-
- if fileToDownload.find('..') > -1 or fileToDownload.find(homePath) == -1:
- return HttpResponse("Unauthorized access.")
-
- response = HttpResponse(content_type='application/force-download')
- response['Content-Disposition'] = 'attachment; filename=%s' % (fileToDownload.split('/')[-1])
- response['X-LiteSpeed-Location'] = '%s' % (fileToDownload)
-
- return response
-
- except KeyError:
- return redirect(loadLoginPage)
-
def controller(request):
try:
data = json.loads(request.body)
@@ -270,3 +237,61 @@ def FileManagerRoot(request):
from plogical.httpProc import httpProc
proc = httpProc(request, template)
return proc.render()
+
+def downloadFile(request):
+ try:
+ userID = request.session['userID']
+ admin = Administrator.objects.get(pk=userID)
+ from urllib.parse import quote
+ from django.utils.encoding import iri_to_uri
+
+ fileToDownload = request.build_absolute_uri().split('fileToDownload')[1][1:]
+ fileToDownload = iri_to_uri(fileToDownload)
+
+ domainName = request.GET.get('domainName')
+
+ currentACL = ACLManager.loadedACL(userID)
+
+ if ACLManager.checkOwnership(domainName, admin, currentACL) == 1:
+ pass
+ else:
+ return ACLManager.loadErrorJson('permissionsChanged', 0)
+
+ homePath = '/home/%s' % (domainName)
+
+ if fileToDownload.find('..') > -1 or fileToDownload.find(homePath) == -1:
+ return HttpResponse("Unauthorized access.")
+
+ response = HttpResponse(content_type='application/force-download')
+ response['Content-Disposition'] = 'attachment; filename=%s' % (fileToDownload.split('/')[-1])
+ response['X-LiteSpeed-Location'] = '%s' % (fileToDownload)
+
+ return response
+
+ except KeyError:
+ return redirect(loadLoginPage)
+
+def RootDownloadFile(request):
+ try:
+ userID = request.session['userID']
+ from urllib.parse import quote
+ from django.utils.encoding import iri_to_uri
+
+ fileToDownload = request.build_absolute_uri().split('fileToDownload')[1][1:]
+ fileToDownload = iri_to_uri(fileToDownload)
+
+ currentACL = ACLManager.loadedACL(userID)
+
+ if currentACL['admin'] == 1:
+ pass
+ else:
+ return ACLManager.loadError()
+
+ response = HttpResponse(content_type='application/force-download')
+ response['Content-Disposition'] = 'attachment; filename=%s' % (fileToDownload.split('/')[-1])
+ response['X-LiteSpeed-Location'] = '%s' % (fileToDownload)
+
+ return response
+ #return HttpResponse(response['X-LiteSpeed-Location'])
+ except KeyError:
+ return redirect(loadLoginPage)