소스 검색

AMBARI-2574. Auth to local shouldn't include hbase rule when hbase not installed. (Antonenko Alexander via yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1500090 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 년 전
부모
커밋
a7e6675807
2개의 변경된 파일15개의 추가작업 그리고 2개의 파일을 삭제
  1. 12 1
      ambari-web/app/controllers/main/admin/security/add/step4.js
  2. 3 1
      ambari-web/app/data/secure_mapping.js

+ 12 - 1
ambari-web/app/controllers/main/admin/security/add/step4.js

@@ -222,7 +222,11 @@ App.MainAdminSecurityAddStep4Controller = Em.Controller.extend({
     var uiConfig = [];
     var configs = this.get('secureMapping').filterProperty('foreignKey', null);
     configs.forEach(function (_config) {
-      var value = this.getGlobConfigValue(_config.templateName, _config.value, _config.name);
+      var value = _config.value;
+      if (_config.hasOwnProperty('dependedServiceName') && _config.hasOwnProperty('replace')) {
+        value = this.checkServiceForConfigValue(value, _config.dependedServiceName, _config.replace);
+      }
+      value = this.getGlobConfigValue(_config.templateName, value, _config.name);
       uiConfig.pushObject({
         "id": "site property",
         "name": _config.name,
@@ -245,6 +249,13 @@ App.MainAdminSecurityAddStep4Controller = Em.Controller.extend({
     return uiConfig;
   },
 
+  checkServiceForConfigValue: function(value, serviceName, replace) {
+    if (!App.Service.find().mapProperty('serviceName').contains(serviceName)) {
+      value = value.replace(replace, '');
+    }
+    return value;
+  },
+
   /**
    * Set all site property that are derived from other puppet-variable
    */

+ 3 - 1
ambari-web/app/data/secure_mapping.js

@@ -40,7 +40,9 @@ module.exports = [
     "foreignKey": null,
     "value": "RULE:[2:$1@$0](<templateName[0]>@.*<templateName[1]>)s/.*/<templateName[2]>/\nRULE:[2:$1@$0](<templateName[3]>@.*<templateName[1]>)s/.*/<templateName[2]>/\nRULE:[2:$1@$0](<templateName[4]>@.*<templateName[1]>)s/.*/<templateName[5]>/\nRULE:[2:$1@$0](<templateName[6]>@.*<templateName[1]>)s/.*/<templateName[5]>/\nRULE:[2:$1@$0](<templateName[7]>@.*<templateName[1]>)s/.*/<templateName[8]>/\nDEFAULT",
     "filename": "core-site.xml",
-    "serviceName": "HDFS"
+    "serviceName": "HDFS",
+    "dependedServiceName": "HBASE",
+    "replace": "\nRULE:[2:$1@$0](<templateName[7]>@.*<templateName[1]>)s/.*/<templateName[8]>/"
   },
   {
     "name": "dfs.namenode.kerberos.principal",