瀏覽代碼

HUE-6466 [aws] Check S3 privileges for user before activating s3 filesystem

Jenny Kim 8 年之前
父節點
當前提交
2aa346000f
共有 1 個文件被更改,包括 3 次插入5 次删除
  1. 3 5
      apps/filebrowser/src/filebrowser/api.py

+ 3 - 5
apps/filebrowser/src/filebrowser/api.py

@@ -17,12 +17,12 @@
 
 import logging
 
-from django.utils.translation import ugettext as _
-
 from desktop.lib.django_util import JsonResponse
 from desktop.lib.fsmanager import FS_GETTERS
 from desktop.lib.i18n import smart_unicode
 
+from aws.conf import has_s3_access
+
 
 LOG = logging.getLogger(__name__)
 
@@ -46,9 +46,7 @@ def get_filesystems(request):
 
   filesystems = {}
   for k, v in FS_GETTERS.items():
-    if k.startswith('s3'):
-      filesystems[k] = v is not None
-    else:
+    if not k.startswith('s3') or has_s3_access(request.user):
       filesystems[k] = v is not None
 
   response['status'] = 0