فهرست منبع

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