ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhew...@apache.org
Subject ambari git commit: AMBARI-17936 Log search tab seems to be visible for all user roles (zhewang)
Date Thu, 28 Jul 2016 20:09:09 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 65b80d3c4 -> 9750eae96


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/9750eae9
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9750eae9
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9750eae9

Branch: refs/heads/branch-2.4
Commit: 9750eae9624e22926907656da69660f412b69963
Parents: 65b80d3
Author: Zhe (Joe) Wang <zhewang@apache.org>
Authored: Thu Jul 28 13:03:34 2016 -0700
Committer: Zhe (Joe) Wang <zhewang@apache.org>
Committed: Thu Jul 28 13:08:48 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/9750eae9/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/9750eae9/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);
       });


Mime
View raw message