Browse Source

[sentry] Set URI scope to URI privileges instead of SERVER

Romain Rigaux 10 năm trước cách đây
mục cha
commit
af5dea7

+ 4 - 2
apps/security/src/security/static/security/js/hive.ko.js

@@ -72,7 +72,7 @@ var Privilege = function (vm, privilege) {
   });
 
   // UI
-  self.privilegeType = ko.observable(typeof privilege.URI != "undefined" && privilege.URI != null && privilege.URI != "" ? "uri" : "db");
+  self.privilegeType = ko.observable(typeof privilege.privilegeScope != "undefined" && privilege.privilegeScope == 'URI' ? "uri" : "db");
   self.showAdvanced = ko.observable(false);
   self.path = ko.computed({
     read: function () {
@@ -95,7 +95,9 @@ var Privilege = function (vm, privilege) {
     owner: self
   });
   self.privilegeScope = ko.computed(function () {
-    if (self.tableName().length > 0) {
+    if (self.privilegeType() == 'uri') {
+      return 'URI';
+    } else if (self.tableName().length > 0) {
       return 'TABLE';
     } else if (self.dbName().length > 0) {
       return 'DATABASE';

+ 6 - 6
desktop/libs/libsentry/src/libsentry/api.py

@@ -15,6 +15,12 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import logging
+import json
+import random
+import threading
+import time
+
 from desktop.lib.exceptions_renderable import PopupException
 from django.utils.translation import ugettext as _
 
@@ -24,12 +30,6 @@ from libsentry.client import SentryClient
 from libsentry.conf import HOSTNAME, PORT
 from libsentry.sentry_site import get_sentry_server_ha_enabled, get_sentry_server_ha_has_security, get_sentry_server_ha_zookeeper_quorum, get_sentry_server_ha_zookeeper_namespace
 
-import logging
-import json
-import random
-import threading
-import time
-
 
 LOG = logging.getLogger(__name__)