ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jai...@apache.org
Subject [1/2] ambari git commit: Revert "AMBARI-14222. Hide/Show features based on user role"
Date Sat, 05 Dec 2015 21:40:50 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 2fd058f4d -> 1efb3abed


http://git-wip-us.apache.org/repos/asf/ambari/blob/1efb3abe/ambari-web/app/views/main/host/hosts_table_menu_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/hosts_table_menu_view.js b/ambari-web/app/views/main/host/hosts_table_menu_view.js
index 1ace762..e974073 100644
--- a/ambari-web/app/views/main/host/hosts_table_menu_view.js
+++ b/ambari-web/app/views/main/host/hosts_table_menu_view.js
@@ -99,68 +99,63 @@ App.HostTableMenuView = Em.View.extend({
 
     operationsInfo: function () {
       var content = this.get('content');
-      var menuItems = Em.A();
-      if (App.isAuthorized("SERVICE.START_STOP")) {
-        menuItems.pushObjects([
-          O.create({
-            label: Em.I18n.t('common.start'),
-            operationData: O.create({
-              action: App.HostComponentStatus.started,
-              message: Em.I18n.t('common.start'),
-              componentName: content.componentName,
-              serviceName: content.serviceName,
-              componentNameFormatted: content.componentNameFormatted
-            })
-          }),
-          O.create({
-            label: Em.I18n.t('common.stop'),
-            operationData: O.create({
-              action: App.HostComponentStatus.stopped,
-              message: Em.I18n.t('common.stop'),
-              componentName: content.componentName,
-              serviceName: content.serviceName,
-              componentNameFormatted: content.componentNameFormatted
-            })
-          }),
-          O.create({
-            label: Em.I18n.t('common.restart'),
-            operationData: O.create({
-              action: 'RESTART',
-              message: Em.I18n.t('common.restart'),
-              componentName: content.componentName,
-              serviceName: content.serviceName,
-              componentNameFormatted: content.componentNameFormatted
-            })
+      var menuItems = Em.A([
+        O.create({
+          label: Em.I18n.t('common.start'),
+          operationData: O.create({
+            action: App.HostComponentStatus.started,
+            message: Em.I18n.t('common.start'),
+            componentName: content.componentName,
+            serviceName: content.serviceName,
+            componentNameFormatted: content.componentNameFormatted
           })
-        ])
-      }
-      if (App.isAuthorized("SERVICE.DECOMMISSION_RECOMMISSION") && App.get('components.decommissionAllowed').contains(content.componentName))
{
-        menuItems.pushObjects([
-          O.create({
-            label: Em.I18n.t('common.decommission'),
-            decommission: true,
-            operationData: O.create({
-              action: 'DECOMMISSION',
-              message: Em.I18n.t('common.decommission'),
-              componentName: content.masterComponentName,
-              realComponentName: content.componentName,
-              serviceName: content.serviceName,
-              componentNameFormatted: content.componentNameFormatted
-            })
-          }),
-          O.create({
-            label: Em.I18n.t('common.recommission'),
-            decommission: true,
-            operationData: O.create({
-              action: 'DECOMMISSION_OFF',
-              message: Em.I18n.t('common.recommission'),
-              componentName: content.masterComponentName,
-              realComponentName: content.componentName,
-              serviceName: content.serviceName,
-              componentNameFormatted: content.componentNameFormatted
-            })
+        }),
+        O.create({
+          label: Em.I18n.t('common.stop'),
+          operationData: O.create({
+            action: App.HostComponentStatus.stopped,
+            message: Em.I18n.t('common.stop'),
+            componentName: content.componentName,
+            serviceName: content.serviceName,
+            componentNameFormatted: content.componentNameFormatted
+          })
+        }),
+        O.create({
+          label: Em.I18n.t('common.restart'),
+          operationData: O.create({
+            action: 'RESTART',
+            message: Em.I18n.t('common.restart'),
+            componentName: content.componentName,
+            serviceName: content.serviceName,
+            componentNameFormatted: content.componentNameFormatted
+          })
+        })
+      ]);
+      if (App.get('components.decommissionAllowed').contains(content.componentName)) {
+        menuItems.pushObject(O.create({
+          label: Em.I18n.t('common.decommission'),
+          decommission: true,
+          operationData: O.create({
+            action: 'DECOMMISSION',
+            message: Em.I18n.t('common.decommission'),
+            componentName: content.masterComponentName,
+            realComponentName: content.componentName,
+            serviceName: content.serviceName,
+            componentNameFormatted: content.componentNameFormatted
+          })
+        }));
+        menuItems.pushObject(O.create({
+          label: Em.I18n.t('common.recommission'),
+          decommission: true,
+          operationData: O.create({
+            action: 'DECOMMISSION_OFF',
+            message: Em.I18n.t('common.recommission'),
+            componentName: content.masterComponentName,
+            realComponentName: content.componentName,
+            serviceName: content.serviceName,
+            componentNameFormatted: content.componentNameFormatted
           })
-        ]);
+        }));
       }
       return menuItems;
     }.property("content"),
@@ -238,63 +233,54 @@ App.HostTableMenuView = Em.View.extend({
      * @returns {Array}
      */
     operationsInfo: function () {
-      var result = [];
-      if (App.isAuthorized("SERVICE.START_STOP")) {
-        result = result.concat([
-          O.create({
-            label: Em.I18n.t('hosts.host.details.startAllComponents'),
-            operationData: O.create({
-              action: 'STARTED',
-              actionToCheck: 'INSTALLED',
-              message: Em.I18n.t('hosts.host.details.startAllComponents')
-            })
-          }),
-          O.create({
-            label: Em.I18n.t('hosts.host.details.stopAllComponents'),
-            operationData: O.create({
-              action: 'INSTALLED',
-              actionToCheck: 'STARTED',
-              message: Em.I18n.t('hosts.host.details.stopAllComponents')
-            })
-          }),
-          O.create({
-            label: Em.I18n.t('hosts.table.menu.l2.restartAllComponents'),
-            operationData: O.create({
-              action: 'RESTART',
-              message: Em.I18n.t('hosts.table.menu.l2.restartAllComponents')
-            })
+      return [
+        O.create({
+          label: Em.I18n.t('hosts.host.details.startAllComponents'),
+          operationData: O.create({
+            action: 'STARTED',
+            actionToCheck: 'INSTALLED',
+            message: Em.I18n.t('hosts.host.details.startAllComponents')
           })
-        ]);
-      }
-
-      if (App.isAuthorized("HOST.TOGGLE_MAINTENANCE")) {
-        result = result.concat([
-          O.create({
-            label: Em.I18n.t('passiveState.turnOn'),
-            operationData: O.create({
-              state: 'ON',
-              action: 'PASSIVE_STATE',
-              message: Em.I18n.t('passiveState.turnOnFor').format('hosts')
-            })
-          }),
-          O.create({
-            label: Em.I18n.t('passiveState.turnOff'),
-            operationData: O.create({
-              state: 'OFF',
-              action: 'PASSIVE_STATE',
-              message: Em.I18n.t('passiveState.turnOffFor').format('hosts')
-            })
+        }),
+        O.create({
+          label: Em.I18n.t('hosts.host.details.stopAllComponents'),
+          operationData: O.create({
+            action: 'INSTALLED',
+            actionToCheck: 'STARTED',
+            message: Em.I18n.t('hosts.host.details.stopAllComponents')
+          })
+        }),
+        O.create({
+          label: Em.I18n.t('hosts.table.menu.l2.restartAllComponents'),
+          operationData: O.create({
+            action: 'RESTART',
+            message: Em.I18n.t('hosts.table.menu.l2.restartAllComponents')
+          })
+        }),
+        O.create({
+          label: Em.I18n.t('passiveState.turnOn'),
+          operationData: O.create({
+            state: 'ON',
+            action: 'PASSIVE_STATE',
+            message: Em.I18n.t('passiveState.turnOnFor').format('hosts')
+          })
+        }),
+        O.create({
+          label: Em.I18n.t('passiveState.turnOff'),
+          operationData: O.create({
+            state: 'OFF',
+            action: 'PASSIVE_STATE',
+            message: Em.I18n.t('passiveState.turnOffFor').format('hosts')
+          })
+        }),
+        O.create({
+          label: Em.I18n.t('hosts.host.details.setRackId'),
+          operationData: O.create({
+            action: 'SET_RACK_INFO',
+            message: Em.I18n.t('hosts.host.details.setRackId').format('hosts')
           })
-        ]);
-      }
-      result = result.concat(O.create({
-        label: Em.I18n.t('hosts.host.details.setRackId'),
-        operationData: O.create({
-          action: 'SET_RACK_INFO',
-          message: Em.I18n.t('hosts.host.details.setRackId').format('hosts')
         })
-      }));
-      return result;
+      ];
     }.property(),
 
     /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/1efb3abe/ambari-web/app/views/main/menu.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/menu.js b/ambari-web/app/views/main/menu.js
index 2c12aec..5585eaf 100644
--- a/ambari-web/app/views/main/menu.js
+++ b/ambari-web/app/views/main/menu.js
@@ -42,7 +42,7 @@ App.MainMenuView = Em.CollectionView.extend({
           { label: Em.I18n.t('menu.item.hosts'), routing: 'hosts', hasAlertsLabel: true},
           { label: Em.I18n.t('menu.item.alerts'), routing: 'alerts'}
         );
-        if (App.isAuthorized('CLUSTER.TOGGLE_KERBEROS, CLUSTER.UPGRADE_DOWNGRADE_STACK'))
{
+        if (App.isAccessible('upgrade_ADMIN')) {
           result.push({ label: Em.I18n.t('menu.item.admin'), routing: 'admin'});
         }
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1efb3abe/ambari-web/app/views/main/service/info/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/summary.js b/ambari-web/app/views/main/service/info/summary.js
index 67b7c7d..6431c91 100644
--- a/ambari-web/app/views/main/service/info/summary.js
+++ b/ambari-web/app/views/main/service/info/summary.js
@@ -462,7 +462,7 @@ App.MainServiceInfoSummaryView = Em.View.extend(App.UserPref, App.TimeRangeMixin
    */
   widgetActions: function() {
     var options = [];
-    if (App.isAuthorized('SERVICE.MODIFY_CONFIGS')) {
+    if (App.isAccessible('MANAGER')) {
       if (App.supports.customizedWidgetLayout) {
         options.pushObjects(this.get('staticWidgetLayoutActions'));
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1efb3abe/ambari-web/app/views/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/item.js b/ambari-web/app/views/main/service/item.js
index 9c72164..edc5d59 100644
--- a/ambari-web/app/views/main/service/item.js
+++ b/ambari-web/app/views/main/service/item.js
@@ -150,7 +150,7 @@ App.MainServiceItemView = Em.View.extend({
           disabled: App.allHostNames.length === App.HostComponent.find().filterProperty('componentName',
master).mapProperty('hostName').length
         }));
       });
-      if (service.get('serviceTypes').contains('HA_MODE') && App.isAuthorized('SERVICE.ENABLE_HA'))
{
+      if (service.get('serviceTypes').contains('HA_MODE')) {
         switch (service.get('serviceName')) {
           case 'HDFS':
             options.push(actionMap.TOGGLE_NN_HA);
@@ -249,7 +249,7 @@ App.MainServiceItemView = Em.View.extend({
   }.property('maintenance'),
 
   hasConfigTab: function() {
-    return App.isAuthorized('CLUSTER.VIEW_CONFIGS') && !App.get('services.noConfigTypes').contains(this.get('controller.content.serviceName'));
+    return !App.get('services.noConfigTypes').contains(this.get('controller.content.serviceName'));
   }.property('controller.content.serviceName','App.services.noConfigTypes'),
 
   hasHeatmapTab: function() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1efb3abe/ambari-web/test/app_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/app_test.js b/ambari-web/test/app_test.js
index 3cc3081..46d9932 100644
--- a/ambari-web/test/app_test.js
+++ b/ambari-web/test/app_test.js
@@ -21,7 +21,6 @@ require('views/common/quick_view_link_view');
 require('models/host_component');
 require('models/stack_service_component');
 var modelSetup = require('test/init_model_test');
-App.auth = ["AMBARI.ADD_DELETE_CLUSTERS", "AMBARI.ASSIGN_ROLES", "AMBARI.EDIT_STACK_REPOS",
"AMBARI.MANAGE_GROUPS", "AMBARI.MANAGE_STACK_VERSIONS", "AMBARI.MANAGE_USERS", "AMBARI.MANAGE_VIEWS",
"AMBARI.RENAME_CLUSTER", "AMBARI.SET_SERVICE_USERS_GROUPS", "CLUSTER.TOGGLE_ALERTS", "CLUSTER.TOGGLE_KERBEROS",
"CLUSTER.UPGRADE_DOWNGRADE_STACK", "CLUSTER.VIEW_ALERTS", "CLUSTER.VIEW_CONFIGS", "CLUSTER.VIEW_METRICS",
"CLUSTER.VIEW_STACK_DETAILS", "CLUSTER.VIEW_STATUS_INFO", "HOST.ADD_DELETE_COMPONENTS", "HOST.ADD_DELETE_HOSTS",
"HOST.TOGGLE_MAINTENANCE", "HOST.VIEW_CONFIGS", "HOST.VIEW_METRICS", "HOST.VIEW_STATUS_INFO",
"SERVICE.ADD_DELETE_SERVICES", "SERVICE.COMPARE_CONFIGS", "SERVICE.DECOMMISSION_RECOMMISSION",
"SERVICE.ENABLE_HA", "SERVICE.MANAGE_CONFIG_GROUPS", "SERVICE.MODIFY_CONFIGS", "SERVICE.MOVE",
"SERVICE.RUN_CUSTOM_COMMAND", "SERVICE.RUN_SERVICE_CHECK", "SERVICE.START_STOP", "SERVICE.TOGGLE_ALERTS",
"SERVICE.TOGGLE_MAINTENANCE", "SERVICE.VIEW_ALERTS", "SERVICE.VIEW_CONFIGS", "SERV
 ICE.VIEW_METRICS", "SERVICE.VIEW_STATUS_INFO", "VIEW.USE"];
 
 describe('App', function () {
 
@@ -379,6 +378,122 @@ describe('App', function () {
     })
   });
 
+  describe("#isAccessible()", function() {
+
+    beforeEach(function () {
+      this.mock = sinon.stub(App.router, 'get');
+    });
+    afterEach(function () {
+      this.mock.restore();
+    });
+
+    it("Upgrade running, element should be blocked", function() {
+      App.set('upgradeState', "IN_PROGRESS");
+      App.set('isAdmin', true);
+      this.mock.withArgs('wizardWatcherController.isNonWizardUser').returns(false);
+      expect(App.isAccessible('ADMIN')).to.be.false;
+    });
+    it("Upgrade running, upgrade element should not be blocked", function() {
+      App.set('upgradeState', "IN_PROGRESS");
+      App.set('isAdmin', true);
+      this.mock.withArgs('wizardWatcherController.isNonWizardUser').returns(false);
+      expect(App.isAccessible('upgrade_ADMIN')).to.be.true;
+    });
+    it("Upgrade running, upgrade element should not be blocked", function() {
+      App.set('upgradeState', "IN_PROGRESS");
+      App.set('isAdmin', true);
+      App.set('supports.opsDuringRollingUpgrade', true);
+      this.mock.withArgs('wizardWatcherController.isNonWizardUser').returns(false);
+      expect(App.isAccessible('ADMIN')).to.be.true;
+      App.set('supports.opsDuringRollingUpgrade', false);
+    });
+    it("ADMIN type, isAdmin true", function() {
+      App.set('upgradeState', "INIT");
+      App.set('isAdmin', true);
+      this.mock.withArgs('wizardWatcherController.isNonWizardUser').returns(false);
+      expect(App.isAccessible('ADMIN')).to.be.true;
+    });
+    it("ADMIN type, isAdmin false", function() {
+      App.set('upgradeState', "INIT");
+      App.set('isAdmin', false);
+      this.mock.withArgs('wizardWatcherController.isNonWizardUser').returns(false);
+      expect(App.isAccessible('ADMIN')).to.be.false;
+    });
+    it("MANAGER type, isOperator false", function() {
+      App.set('upgradeState', "INIT");
+      App.set('isAdmin', true);
+      App.set('isOperator', false);
+      this.mock.withArgs('wizardWatcherController.isNonWizardUser').returns(false);
+      expect(App.isAccessible('MANAGER')).to.be.true;
+    });
+    it("MANAGER type, isAdmin false", function() {
+      App.set('upgradeState', "INIT");
+      App.set('isAdmin', false);
+      App.set('isOperator', true);
+      this.mock.withArgs('wizardWatcherController.isNonWizardUser').returns(false);
+      expect(App.isAccessible('MANAGER')).to.be.true;
+    });
+    it("MANAGER type, isAdmin and isOperator false", function() {
+      App.set('upgradeState', "INIT");
+      App.set('isAdmin', false);
+      App.set('isOperator', false);
+      this.mock.withArgs('wizardWatcherController.isNonWizardUser').returns(false);
+      expect(App.isAccessible('MANAGER')).to.be.false;
+    });
+    it("OPERATOR type, isOperator false", function() {
+      App.set('upgradeState', "INIT");
+      App.set('isOperator', false);
+      this.mock.withArgs('wizardWatcherController.isNonWizardUser').returns(false);
+      expect(App.isAccessible('OPERATOR')).to.be.false;
+    });
+    it("OPERATOR type, isOperator false", function() {
+      App.set('upgradeState', "INIT");
+      App.set('isOperator', true);
+      this.mock.withArgs('wizardWatcherController.isNonWizardUser').returns(false);
+      expect(App.isAccessible('OPERATOR')).to.be.true;
+    });
+    it("ONLY_ADMIN type, isAdmin false", function() {
+      App.set('upgradeState', "INIT");
+      App.set('isAdmin', false);
+      this.mock.withArgs('wizardWatcherController.isNonWizardUser').returns(false);
+      expect(App.isAccessible('ONLY_ADMIN')).to.be.false;
+    });
+    it("ONLY_ADMIN type, isAdmin true, isOperator false", function() {
+      App.set('upgradeState', "INIT");
+      App.set('isAdmin', true);
+      App.set('isOperator', false);
+      this.mock.withArgs('wizardWatcherController.isNonWizardUser').returns(false);
+      expect(App.isAccessible('ONLY_ADMIN')).to.be.true;
+    });
+    it("ONLY_ADMIN type, isAdmin true, isOperator true", function() {
+      App.set('upgradeState', "INIT");
+      App.set('isAdmin', true);
+      App.set('isOperator', true);
+      this.mock.withArgs('wizardWatcherController.isNonWizardUser').returns(false);
+      expect(App.isAccessible('ONLY_ADMIN')).to.be.false;
+    });
+    it("unknown type", function() {
+      App.set('upgradeState', "INIT");
+      this.mock.withArgs('wizardWatcherController.isNonWizardUser').returns(false);
+      expect(App.isAccessible('')).to.be.false;
+    });
+    it("ONLY_ADMIN type, isAdmin true, isOperator true, isSuspended true", function() {
+      App.set('upgradeState', "ABORTED");
+      App.set('isAdmin', true);
+      App.set('isOperator', false);
+      this.mock.withArgs('wizardWatcherController.isNonWizardUser').returns(false);
+      this.mock.withArgs('mainAdminStackAndUpgradeController.isSuspended').returns(true);
+      expect(App.isAccessible('ONLY_ADMIN')).to.be.true;
+    });
+    it("ONLY_ADMIN type, isNonWizardUser true", function() {
+      App.set('upgradeState', "ABORTED");
+      App.set('isAdmin', true);
+      App.set('isOperator', false);
+      this.mock.withArgs('wizardWatcherController.isNonWizardUser').returns(true);
+      expect(App.isAccessible('ONLY_ADMIN')).to.be.false;
+    });
+  });
+
   describe('#isHadoop20Stack', function () {
 
     Em.A([

http://git-wip-us.apache.org/repos/asf/ambari/blob/1efb3abe/ambari-web/test/controllers/experimental_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/experimental_test.js b/ambari-web/test/controllers/experimental_test.js
index bfb238f..b6fd522 100644
--- a/ambari-web/test/controllers/experimental_test.js
+++ b/ambari-web/test/controllers/experimental_test.js
@@ -62,7 +62,8 @@ describe('App.ExperimentalController', function () {
     });
   });
 
-  describe.skip('#doSave', function () {
+  describe('#doSave', function () {
+
     before(function () {
       sinon.stub(Ember, 'set', function (p, v) {
         if (p.indexOf('App.supports.' != -1)) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1efb3abe/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
index 9a3e46d..1424863 100644
--- a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
@@ -20,8 +20,6 @@
 var App = require('app');
 require('controllers/main/admin/stack_and_upgrade_controller');
 require('utils/string_utils');
-App.auth = ["AMBARI.ADD_DELETE_CLUSTERS", "AMBARI.ASSIGN_ROLES", "AMBARI.EDIT_STACK_REPOS",
"AMBARI.MANAGE_GROUPS", "AMBARI.MANAGE_STACK_VERSIONS", "AMBARI.MANAGE_USERS", "AMBARI.MANAGE_VIEWS",
"AMBARI.RENAME_CLUSTER", "AMBARI.SET_SERVICE_USERS_GROUPS", "CLUSTER.TOGGLE_ALERTS", "CLUSTER.TOGGLE_KERBEROS",
"CLUSTER.UPGRADE_DOWNGRADE_STACK", "CLUSTER.VIEW_ALERTS", "CLUSTER.VIEW_CONFIGS", "CLUSTER.VIEW_METRICS",
"CLUSTER.VIEW_STACK_DETAILS", "CLUSTER.VIEW_STATUS_INFO", "HOST.ADD_DELETE_COMPONENTS", "HOST.ADD_DELETE_HOSTS",
"HOST.TOGGLE_MAINTENANCE", "HOST.VIEW_CONFIGS", "HOST.VIEW_METRICS", "HOST.VIEW_STATUS_INFO",
"SERVICE.ADD_DELETE_SERVICES", "SERVICE.COMPARE_CONFIGS", "SERVICE.DECOMMISSION_RECOMMISSION",
"SERVICE.ENABLE_HA", "SERVICE.MANAGE_CONFIG_GROUPS", "SERVICE.MODIFY_CONFIGS", "SERVICE.MOVE",
"SERVICE.RUN_CUSTOM_COMMAND", "SERVICE.RUN_SERVICE_CHECK", "SERVICE.START_STOP", "SERVICE.TOGGLE_ALERTS",
"SERVICE.TOGGLE_MAINTENANCE", "SERVICE.VIEW_ALERTS", "SERVICE.VIEW_CONFIGS", "SERV
 ICE.VIEW_METRICS", "SERVICE.VIEW_STATUS_INFO", "VIEW.USE"];
-
 
 describe('App.MainAdminStackAndUpgradeController', function() {
 
@@ -1097,6 +1095,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
       controller.saveRepoOS(Em.Object.create({repoVersionId: 1}), true);
       expect(controller.validateRepoVersions.calledWith(Em.Object.create({repoVersionId:
1}), true)).to.be.true;
       expect(controller.prepareRepoForSaving.calledWith(Em.Object.create({repoVersionId:
1}))).to.be.true;
+      expect(App.ajax.send.calledOnce).to.be.true;
     });
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1efb3abe/ambari-web/test/controllers/wizard/step7_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step7_test.js b/ambari-web/test/controllers/wizard/step7_test.js
index bba552a..8062f44 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -1143,6 +1143,12 @@ describe('App.InstallerStep7Controller', function () {
   });
 
   describe('#_updateIsEditableFlagForConfig', function () {
+    beforeEach(function(){
+      this.mock = sinon.stub(App, 'isAccessible');
+    });
+    afterEach(function () {
+      this.mock.restore();
+    });
     Em.A([
         {
           isAdmin: false,
@@ -1175,9 +1181,18 @@ describe('App.InstallerStep7Controller', function () {
           defaultGroupSelected: false,
           m: 'false if defaultGroupSelected is false and isHostsConfigsPage is false',
           e: false
+        },
+        {
+          isAdmin: true,
+          isReconfigurable: true,
+          isHostsConfigsPage: false,
+          defaultGroupSelected: true,
+          m: 'equal to isReconfigurable if defaultGroupSelected is true and isHostsConfigsPage
is false',
+          e: true
         }
       ]).forEach(function (test) {
         it(test.m, function () {
+          this.mock.returns(test.isAdmin);
           installerStep7Controller.reopen({isHostsConfigsPage: test.isHostsConfigsPage});
           var serviceConfigProperty = Em.Object.create({
             isReconfigurable: test.isReconfigurable

http://git-wip-us.apache.org/repos/asf/ambari/blob/1efb3abe/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js b/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js
index bc0907e..3154449 100644
--- a/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js
+++ b/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js
@@ -56,13 +56,13 @@ describe('App.MainAdminStackServicesView', function () {
       sinon.stub(App.get('router'), 'transitionTo', Em.K);
       sinon.stub(App.router, 'get').returns(mock);
       sinon.spy(mock, 'checkAndStartKerberosWizard');
-      isAccessibleMock = sinon.stub(App, 'isAuthorized');
+      isAccessibleMock = sinon.stub(App, 'isAccessible');
     });
     afterEach(function() {
       App.get('router').transitionTo.restore();
       App.router.get.restore();
       mock.checkAndStartKerberosWizard.restore();
-      App.isAuthorized.restore();
+      App.isAccessible.restore();
     });
     it ("operations locked", function () {
       isAccessibleMock.returns(false);
@@ -92,11 +92,11 @@ describe('App.MainAdminStackServicesView', function () {
       isAccessibleMock;
 
     beforeEach(function() {
-      isAccessibleMock = sinon.stub(App, 'isAuthorized');
+      isAccessibleMock = sinon.stub(App, 'isAccessible');
     });
 
     afterEach(function() {
-      App.isAuthorized.restore();
+      App.isAccessible.restore();
     });
 
     cases.forEach(function (item) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1efb3abe/ambari-web/test/views/main/admin/stack_upgrade/upgrade_version_box_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_version_box_view_test.js
b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_version_box_view_test.js
index 2c58be3..771b149 100644
--- a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_version_box_view_test.js
+++ b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_version_box_view_test.js
@@ -360,13 +360,13 @@ describe('App.UpgradeVersionBoxView', function () {
           ]
         },
         setup: function () {
-          this.isAccessibleMock.withArgs('CLUSTER.UPGRADE_DOWNGRADE_STACK').returns(false);
+          this.isAccessibleMock.withArgs('ADMIN').returns(false);
         },
         expected: {
           status: 'INIT',
           isButton: true,
           buttons: [],
-          isDisabled: false
+          isDisabled: true
         },
         title: 'INIT state, no admin access, no requests in progress'
       },
@@ -381,7 +381,7 @@ describe('App.UpgradeVersionBoxView', function () {
           ]
         },
         setup: function () {
-          this.isAccessibleMock.withArgs('CLUSTER.UPGRADE_DOWNGRADE_STACK').returns(false);
+          this.isAccessibleMock.withArgs('ADMIN').returns(false);
         },
         expected: {
           status: 'INIT',
@@ -411,7 +411,7 @@ describe('App.UpgradeVersionBoxView', function () {
           'content.displayName': 'HDP-2.2.1'
         },
         setup: function () {
-          this.isAccessibleMock.withArgs('CLUSTER.UPGRADE_DOWNGRADE_STACK').returns(false);
+          this.isAccessibleMock.withArgs('ADMIN').returns(false);
         },
         expected: {
           status: 'INSTALL_FAILED',
@@ -447,7 +447,7 @@ describe('App.UpgradeVersionBoxView', function () {
           'content.displayName': 'HDP-2.2.1'
         },
         setup: function () {
-          this.isAccessibleMock.withArgs('CLUSTER.UPGRADE_DOWNGRADE_STACK').returns(false);
+          this.isAccessibleMock.withArgs('ADMIN').returns(false);
         },
         expected: {
           status: 'INSTALL_FAILED',
@@ -480,7 +480,7 @@ describe('App.UpgradeVersionBoxView', function () {
           'content.displayName': 'HDP-2.2.1'
         },
         setup: function () {
-          this.isAccessibleMock.withArgs('CLUSTER.UPGRADE_DOWNGRADE_STACK').returns(true);
+          this.isAccessibleMock.withArgs('ADMIN').returns(true);
         },
         expected: {
           status: 'OUT_OF_SYNC',
@@ -513,7 +513,7 @@ describe('App.UpgradeVersionBoxView', function () {
           'content.displayName': 'HDP-2.2.1'
         },
         setup: function () {
-          this.isAccessibleMock.withArgs('CLUSTER.UPGRADE_DOWNGRADE_STACK').returns(true);
+          this.isAccessibleMock.withArgs('ADMIN').returns(true);
         },
         expected: {
           status: 'OUT_OF_SYNC',
@@ -568,7 +568,7 @@ describe('App.UpgradeVersionBoxView', function () {
           'content.displayName': 'HDP-2.2.1'
         },
         setup: function () {
-          this.isAccessibleMock.withArgs('CLUSTER.UPGRADE_DOWNGRADE_STACK').returns(true);
+          this.isAccessibleMock.withArgs('ADMIN').returns(true);
         },
         expected: {
           status: 'INSTALLED',
@@ -604,7 +604,7 @@ describe('App.UpgradeVersionBoxView', function () {
           'content.displayName': 'HDP-2.2.0'
         },
         setup: function () {
-          this.isAccessibleMock.withArgs('CLUSTER.UPGRADE_DOWNGRADE_STACK').returns(true);
+          this.isAccessibleMock.withArgs('ADMIN').returns(true);
         },
         expected: {
           status: 'INSTALLED',
@@ -823,7 +823,7 @@ describe('App.UpgradeVersionBoxView', function () {
 
     beforeEach(function () {
       this.getMock = sinon.stub(App, 'get');
-      this.isAccessibleMock = sinon.stub(App, 'isAuthorized');
+      this.isAccessibleMock = sinon.stub(App, 'isAccessible');
     });
     afterEach(function () {
       this.getMock.restore();


Mime
View raw message