Преглед на файлове

HUE-7107 [core] Hue 4 group access doesn't reflect on Interface

Romain Rigaux преди 8 години
родител
ревизия
f69521c

+ 3 - 3
desktop/core/src/desktop/models.py

@@ -42,7 +42,7 @@ from django.utils.translation import ugettext as _, ugettext_lazy as _t
 from settings import HUE_DESKTOP_VERSION
 
 from aws.conf import is_enabled as is_s3_enabled, has_s3_access
-from dashboard.conf import IS_ENABLED as IS_DASHBOARD_ENABLED
+from dashboard.conf import get_engines
 from notebook.conf import SHOW_NOTEBOOKS, get_ordered_interpreters
 
 from desktop import appmanager
@@ -1680,9 +1680,9 @@ class ClusterConfig():
       return None
 
   def _get_dashboard(self):
-    interpreters = [] # TODO Integrate SQL Dashboards and Solr 6 configs
+    interpreters = get_engines(self.user)
 
-    if IS_DASHBOARD_ENABLED.get() and (self.cluster_type not in (DATAENG, IMPALAUI)):
+    if interpreters and (self.cluster_type not in (DATAENG, IMPALAUI)):
       return {
         'name': 'dashboard',
         'displayName': _('Dashboard'),

+ 1 - 1
desktop/core/src/desktop/templates/hue.mako

@@ -123,7 +123,7 @@ ${ hueIcons.symbols() }
           </a>
           <!-- /ko -->
           <!-- /ko -->
-          <button class="btn btn-primary dropdown-toggle hue-main-create-btn-dropdown" data-toggle="dropdown" data-bind="visible: quickCreateActions().length > 1">
+          <button class="btn btn-primary dropdown-toggle hue-main-create-btn-dropdown" data-toggle="dropdown" data-bind="visible: quickCreateActions().length > 1 || (quickCreateActions().length == 1 && quickCreateActions()[0].children && quickCreateActions()[0].children.length > 1)">
             <!-- ko ifnot: mainQuickCreateAction -->${ _('More') } <!-- /ko -->
             <span class="caret"></span>
           </button>

+ 1 - 1
desktop/libs/dashboard/src/dashboard/conf.py

@@ -68,7 +68,7 @@ def get_properties():
 
 def get_engines(user):
   engines = []
-  apps = get_apps_dict()
+  apps = get_apps_dict(user=user)
   settings = get_properties()
 
   if 'search' in apps:

+ 14 - 3
desktop/libs/notebook/src/notebook/conf.py

@@ -52,11 +52,22 @@ def get_ordered_interpreters(user=None):
   interpreters = INTERPRETERS.get()
   interpreters_shown_on_wheel = _remove_duplications(INTERPRETERS_SHOWN_ON_WHEEL.get())
 
-  unknown_interpreters = set(interpreters_shown_on_wheel) - set(interpreters)
+  user_apps = appmanager.get_apps_dict(user)
+  user_interpreters = []
+  for interpreter in interpreters:
+    if (interpreter == 'hive' and 'beeswax' not in user_apps) or \
+        (interpreter == 'impala' and 'impala' not in user_apps) or \
+        (interpreter == 'pig' and 'pig' not in user_apps) or \
+        (interpreter in ('java', 'spark2', 'mapreduce', 'shell', 'sqoop1', 'distcp') and 'oozie' not in user_apps):
+      pass # Not allowed
+    else:
+      user_interpreters.append(interpreter)
+
+  unknown_interpreters = set(interpreters_shown_on_wheel) - set(user_interpreters)
   if unknown_interpreters:
-      raise ValueError("Interpreters from interpreters_shown_on_wheel is not in the list of Interpreters %s" % unknown_interpreters)
+    raise ValueError("Interpreters from interpreters_shown_on_wheel is not in the list of Interpreters %s" % unknown_interpreters)
 
-  reordered_interpreters = interpreters_shown_on_wheel + [i for i in interpreters if i not in interpreters_shown_on_wheel]
+  reordered_interpreters = interpreters_shown_on_wheel + [i for i in user_interpreters if i not in interpreters_shown_on_wheel]
 
   return [{
       "name": interpreters[i].NAME.get(),