You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2015/12/23 16:07:23 UTC
[44/51] [abbrv] ambari git commit: AMBARI-14470 User can change
properties that should not be reconfigurable and overridable. (ababiichuk)
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/branch-dev-patch-upgrade
Commit: 9c94ac95b97f66da5a6f5d0b988904949396afd2
Parents: 0f4c98c
Author: ababiichuk <ab...@hortonworks.com>
Authored: Tue Dec 22 18:21:22 2015 +0200
Committer: ababiichuk <ab...@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);