Эх сурвалжийг харах

HUE-8006 [home] Document sharing inconsistencies

Roohi 7 жил өмнө
parent
commit
b07c20eaf1

+ 1 - 2
desktop/core/src/desktop/static/desktop/js/document/hueFileEntry.js

@@ -85,7 +85,6 @@ var HueFileEntry = (function () {
     self.apiHelper = options.apiHelper;
     self.app = options.app;
     self.user = options.user;
-    self.userGroups = options.userGroups;
     self.superuser = options.superuser;
     self.serverTypeFilter = options.serverTypeFilter || ko.observable({ type: 'all' });
     self.statsVisible = ko.observable(false);
@@ -182,7 +181,7 @@ var HueFileEntry = (function () {
             return user.username == self.user;
           }).length > 0
           || perms.write.groups.filter(function (writeGroup) {
-            return self.userGroups.indexOf(writeGroup) !== -1
+            return LOGGED_USERGROUPS.indexOf(writeGroup.name) !== -1
           }).length > 0));
     });
 

+ 3 - 2
desktop/core/src/desktop/static/desktop/js/hue.utils.js

@@ -443,7 +443,9 @@ window.hueUtils = window.hueUtils || (function () {
   };
 
   hueUtils.highlight = function (text, searchTerm) {
-    if(searchTerm === '' || text === '') return text;
+    if (searchTerm === '' || text === '') {
+      return text;
+    }
 
     var remText = text;
     var highLightedText = '';
@@ -458,7 +460,6 @@ window.hueUtils = window.hueUtils || (function () {
       } else {
          highLightedText += remText;
       }
-
     } while (startIndex >= 0);
 
     return highLightedText;

+ 0 - 6
desktop/core/src/desktop/templates/common_home.mako

@@ -69,15 +69,9 @@
       ko.options.deferUpdates = true;
     }
 
-    var userGroups = [];
-    % for group in user.groups.all():
-      userGroups.push('${ group }');
-    % endfor
-
     $(document).ready(function () {
       var options = {
         user: '${ user.username }',
-        userGroups: userGroups,
         superuser: '${ user.is_superuser }' === 'True',
         i18n: {
           errorFetchingTableDetails: '${_('An error occurred fetching the table details. Please try again.')}',

+ 7 - 0
desktop/core/src/desktop/templates/global_js_constants.mako

@@ -188,6 +188,13 @@
 
   window.LOGGED_USERNAME = '${ user.username }';
 
+  var userGroups = [];
+  % for group in user.groups.all():
+    userGroups.push('${ group }');
+  % endfor
+
+  window.LOGGED_USERGROUPS = userGroups;
+
   window.METASTORE_PARTITION_LIMIT = ${ hasattr(LIST_PARTITIONS_LIMIT, 'get') and LIST_PARTITIONS_LIMIT.get() or 1000 };
 
   window.SQL_COLUMNS_KNOWN_FACET_VALUES = {