ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject ambari git commit: AMBARI-14470 User can change properties that should not be reconfigurable and overridable. (ababiichuk)
Date Wed, 23 Dec 2015 06:54:04 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 0f4c98ccb -> 9c94ac95b


AMBARI-14470 User can change properties that should not be reconfigurable and overridable.
(ababiichuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9c94ac95
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9c94ac95
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9c94ac95

Branch: refs/heads/trunk
Commit: 9c94ac95b97f66da5a6f5d0b988904949396afd2
Parents: 0f4c98c
Author: ababiichuk <ababiichuk@hortonworks.com>
Authored: Tue Dec 22 18:21:22 2015 +0200
Committer: ababiichuk <ababiichuk@hortonworks.com>
Committed: Wed Dec 23 08:53:14 2015 +0200

----------------------------------------------------------------------
 ambari-web/app/utils/config.js       |  8 ++++---
 ambari-web/test/utils/config_test.js | 38 +++++++++++++++++++++++--------
 2 files changed, 34 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9c94ac95/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index f474748..df92ebe 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -269,9 +269,11 @@ App.config = Em.Object.create({
    * @param {object} config
    */
   restrictSecureProperties: function (config) {
-    var isReadOnly = config.isSecureConfig && App.get('isKerberosEnabled');
-    config.isReconfigurable = !isReadOnly;
-    config.isOverridable = !isReadOnly;
+    if (config.isSecureConfig) {
+      var isReadOnly = App.get('isKerberosEnabled');
+      config.isReconfigurable = config.isReconfigurable && !isReadOnly;
+      config.isOverridable = config.isOverridable && !isReadOnly;
+    }
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/9c94ac95/ambari-web/test/utils/config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/config_test.js b/ambari-web/test/utils/config_test.js
index d3b4d8d..2aec6cc 100644
--- a/ambari-web/test/utils/config_test.js
+++ b/ambari-web/test/utils/config_test.js
@@ -1017,7 +1017,9 @@ describe('App.config', function () {
       {
         input: {
           isSecureConfig: true,
-          isKerberosEnabled: true
+          isKerberosEnabled: true,
+          isReconfigurable: false,
+          isOverridable: false
         },
         expected: {
           isReconfigurable: false,
@@ -1026,18 +1028,22 @@ describe('App.config', function () {
       },
       {
         input: {
-          isSecureConfig: false,
-          isKerberosEnabled: true
-        },
-        expected: {
+          isSecureConfig: true,
+          isKerberosEnabled: true,
           isReconfigurable: true,
           isOverridable: true
+        },
+        expected: {
+          isReconfigurable: false,
+          isOverridable: false
         }
       },
       {
         input: {
           isSecureConfig: true,
-          isKerberosEnabled: false
+          isKerberosEnabled: false,
+          isReconfigurable: true,
+          isOverridable: true
         },
         expected: {
           isReconfigurable: true,
@@ -1047,7 +1053,19 @@ describe('App.config', function () {
       {
         input: {
           isSecureConfig: false,
-          isKerberosEnabled: false
+          isReconfigurable: false,
+          isOverridable: false
+        },
+        expected: {
+          isReconfigurable: false,
+          isOverridable: false
+        }
+      },
+      {
+        input: {
+          isSecureConfig: false,
+          isReconfigurable: true,
+          isOverridable: true
         },
         expected: {
           isReconfigurable: true,
@@ -1059,9 +1077,11 @@ describe('App.config', function () {
     testCases.forEach(function(test) {
       it("isSecureConfig = " + test.input.isSecureConfig + "; isKerberosEnabled = " + test.input.isKerberosEnabled,
function() {
         var config = {
-          isSecureConfig: test.input.isSecureConfig
+          isSecureConfig: test.input.isSecureConfig,
+          isReconfigurable: test.input.isReconfigurable,
+          isOverridable: test.input.isOverridable
         };
-        App.set('isKerberosEnabled', test.input.isKerberosEnabled);
+        App.set('isKerberosEnabled', !!test.input.isKerberosEnabled);
         App.config.restrictSecureProperties(config);
         expect(config.isReconfigurable).to.equal(test.expected.isReconfigurable);
         expect(config.isOverridable).to.equal(test.expected.isOverridable);


Mime
View raw message