Repository: ambari Updated Branches: refs/heads/trunk cdc268f1b -> 176690d9c
AMBARI-17936 Log search tab seems to be visible for all user roles (zhewang) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/176690d9 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/176690d9 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/176690d9 Branch: refs/heads/trunk Commit: 176690d9c1cea18d9097fd28d1a2038f1f6ac93f Parents: cdc268f Author: Zhe (Joe) Wang <[email protected]> Authored: Thu Jul 28 13:03:34 2016 -0700 Committer: Zhe (Joe) Wang <[email protected]> Committed: Thu Jul 28 13:03:34 2016 -0700 ---------------------------------------------------------------------- ambari-web/app/views/main/host/menu.js | 2 +- ambari-web/test/views/main/host/menu_test.js | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/176690d9/ambari-web/app/views/main/host/menu.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/host/menu.js b/ambari-web/app/views/main/host/menu.js index 07d9def..b3c52f4 100644 --- a/ambari-web/app/views/main/host/menu.js +++ b/ambari-web/app/views/main/host/menu.js @@ -58,7 +58,7 @@ App.MainHostMenuView = Em.CollectionView.extend({ routing: 'logs', hidden: function () { if (App.get('supports.logSearch')) { - return !(App.Service.find().someProperty('serviceName', 'LOGSEARCH') && !App.get('isClusterUser')); + return !(App.Service.find().someProperty('serviceName', 'LOGSEARCH') && App.isAuthorized('SERVICE.VIEW_OPERATIONAL_LOGS')); } return true; }.property('App.supports.logSearch'), http://git-wip-us.apache.org/repos/asf/ambari/blob/176690d9/ambari-web/test/views/main/host/menu_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/host/menu_test.js b/ambari-web/test/views/main/host/menu_test.js index f7d35a4..0938a9a 100644 --- a/ambari-web/test/views/main/host/menu_test.js +++ b/ambari-web/test/views/main/host/menu_test.js @@ -30,12 +30,13 @@ describe('App.MainHostMenuView', function () { beforeEach(function () { this.mock = sinon.stub(App, 'get'); this.serviceMock = sinon.stub(App.Service, 'find'); - this.clusterUserMock = this.mock.withArgs('isClusterUser'); + this.authMock = sinon.stub(App, 'isAuthorized'); }); afterEach(function () { App.get.restore(); App.Service.find.restore(); + App.isAuthorized.restore(); }); Em.A([ @@ -61,28 +62,28 @@ describe('App.MainHostMenuView', function () { { logSearch: false, services: [{serviceName: 'LOGSEARCH'}], - isClusterUser: false, + auth: true, m: '`logs` tab is invisible', e: true }, { logSearch: true, services: [], - isClusterUser: false, + auth: true, m: '`logs` tab is invisible because service not installed', e: true }, { logSearch: true, services: [{serviceName: 'LOGSEARCH'}], - isClusterUser: false, + auth: true, m: '`logs` tab is visible', e: false }, { logSearch: true, services: [{serviceName: 'LOGSEARCH'}], - isClusterUser: true, + auth: false, m: '`logs` tab is hidden because user has no access', e: true } @@ -90,7 +91,7 @@ describe('App.MainHostMenuView', function () { it(test.m, function() { this.mock.withArgs('supports.logSearch').returns(test.logSearch); this.serviceMock.returns(test.services); - this.clusterUserMock.returns(test.isClusterUser); + this.authMock.returns(test.auth); view.propertyDidChange('content'); expect(view.get('content').findProperty('name', 'logs').get('hidden')).to.equal(test.e); });
