Procházet zdrojové kódy

[libsentry] Support update of privilegse from the assist page

Update sentry service port
Romain Rigaux před 11 roky
rodič
revize
ccb62a22bd

+ 1 - 1
apps/security/src/security/api/hive.py

@@ -214,7 +214,7 @@ def list_sentry_privileges_by_authorizable(request):
         privilege['roleName'] = role['name']
         privilege['roleName'] = role['name']
         privileges.append(privilege)
         privileges.append(privilege)
 
 
-    result['privileges'] = privileges
+    result['privileges'] = sorted(roles, key= lambda privileges: privileges['roleName'])
 
 
     result['message'] = ''
     result['message'] = ''
     result['status'] = 0
     result['status'] = 0

+ 1 - 1
apps/security/src/security/templates/hive.mako

@@ -53,7 +53,7 @@ ${ layout.menubar(section='hive') }
     <div class="inline-block" style="vertical-align: middle">
     <div class="inline-block" style="vertical-align: middle">
       <a class="pointer" style="padding-top: 4px" data-bind="click: function(){ privilegeType('db'); }"><i class="fa fa-fw fa-1halfx muted" data-bind="css: {'fa-circle-o': privilegeType() != 'db' , 'fa-check-circle-o': privilegeType() == 'db'}"></i></a>
       <a class="pointer" style="padding-top: 4px" data-bind="click: function(){ privilegeType('db'); }"><i class="fa fa-fw fa-1halfx muted" data-bind="css: {'fa-circle-o': privilegeType() != 'db' , 'fa-check-circle-o': privilegeType() == 'db'}"></i></a>
     </div>
     </div>
-    <input type="text" data-bind="hivechooser: $data.path, enable: privilegeType() == 'db'" placeholder="dbName.tableName">
+    <input type="text" data-bind="hivechooser: $data.path, enable: privilegeType() == 'db'" placeholder="dbName.tableName <CTRL+SPACE>">
 
 
     <div class="inline-block" style="vertical-align: middle">
     <div class="inline-block" style="vertical-align: middle">
       <a class="pointer" style="padding-top: 4px" data-bind="click: function(){ privilegeType('uri'); }"><i class="fa fa-fw fa-1halfx muted" data-bind="css: {'fa-circle-o': privilegeType() != 'uri' , 'fa-check-circle-o': privilegeType() == 'uri'}"></i></a>
       <a class="pointer" style="padding-top: 4px" data-bind="click: function(){ privilegeType('uri'); }"><i class="fa fa-fw fa-1halfx muted" data-bind="css: {'fa-circle-o': privilegeType() != 'uri' , 'fa-check-circle-o': privilegeType() == 'uri'}"></i></a>

+ 7 - 1
apps/security/static/js/hive.ko.js

@@ -972,7 +972,13 @@ var HiveViewModel = function (initial) {
               var _idx = self.assist.roles.push(new Role(self, { name: item.roleName }));
               var _idx = self.assist.roles.push(new Role(self, { name: item.roleName }));
               _role = self.assist.roles()[_idx - 1];
               _role = self.assist.roles()[_idx - 1];
             }
             }
-            _role.privileges.push(_create_ko_privilege(item));
+            //_role.privileges.push(_create_ko_privilege(item));
+            var privilege = _create_ko_privilege(item);
+            var privilegeCopy = _create_ko_privilege(item);
+            privilegeCopy.id(privilege.id());
+            _role.privileges.push(privilege);
+            _role.originalPrivileges.push(privilegeCopy);            
+            
             _privileges.push(_create_ko_privilege(item));
             _privileges.push(_create_ko_privilege(item));
           }
           }
         });
         });

+ 3 - 0
desktop/conf.dist/hue.ini

@@ -939,3 +939,6 @@
 
 
   # Port the sentry service is running on.
   # Port the sentry service is running on.
   ## port=8038
   ## port=8038
+
+  # Sentry configuration directory, where sentry-site.xml is located.
+  ## sentry_conf_dir=/etc/sentry/conf

+ 3 - 0
desktop/conf/pseudo-distributed.ini.tmpl

@@ -946,3 +946,6 @@
 
 
   # Port the sentry service is running on.
   # Port the sentry service is running on.
   ## port=8038
   ## port=8038
+
+  # Sentry configuration directory, where sentry-site.xml is located.
+  ## sentry_conf_dir=/etc/sentry/conf

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

@@ -32,7 +32,7 @@ PORT=Config(
   key='port',
   key='port',
   help=_t('Port the sentry service is running on.'),
   help=_t('Port the sentry service is running on.'),
   type=int,
   type=int,
-  default=10001,
+  default=8038,
 )
 )
 
 
 SENTRY_CONF_DIR = Config(
 SENTRY_CONF_DIR = Config(