Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CFC0017C43 for ; Tue, 2 Jun 2015 11:57:12 +0000 (UTC) Received: (qmail 45247 invoked by uid 500); 2 Jun 2015 11:57:12 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 45216 invoked by uid 500); 2 Jun 2015 11:57:12 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 45207 invoked by uid 99); 2 Jun 2015 11:57:12 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Jun 2015 11:57:12 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8B0AFDFB02; Tue, 2 Jun 2015 11:57:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: onechiporenko@apache.org To: commits@ambari.apache.org Message-Id: <8c8ea0d0630745bd95f65fb873ac5b96@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-11609. User with Read-Only access can't visit service configs page (onechiporenko) Date: Tue, 2 Jun 2015 11:57:12 +0000 (UTC) Repository: ambari Updated Branches: refs/heads/trunk ad5b54524 -> 46bf5cb13 AMBARI-11609. User with Read-Only access can't visit service configs page (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/46bf5cb1 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/46bf5cb1 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/46bf5cb1 Branch: refs/heads/trunk Commit: 46bf5cb1377db5168f6c99e79f436030d9531ab5 Parents: ad5b545 Author: Oleg Nechiporenko Authored: Tue Jun 2 14:10:28 2015 +0300 Committer: Oleg Nechiporenko Committed: Tue Jun 2 14:10:28 2015 +0300 ---------------------------------------------------------------------- .../controllers/main/service/info/configs.js | 31 +++++++++++++------- .../app/views/main/host/configs_service.js | 8 +++-- .../main/service/info/config_test.js | 26 ++++++++++++++++ 3 files changed, 53 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/46bf5cb1/ambari-web/app/controllers/main/service/info/configs.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js index c5bcf9f..007b610 100644 --- a/ambari-web/app/controllers/main/service/info/configs.js +++ b/ambari-web/app/controllers/main/service/info/configs.js @@ -135,7 +135,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM * @type {boolean} */ canEdit: function () { - return this.get('isCurrentSelected') && !this.get('isCompareMode'); + return this.get('isCurrentSelected') && !this.get('isCompareMode') && App.isAccessible('MANAGER'); }.property('isCurrentSelected', 'isCompareMode'), serviceConfigs: function () { @@ -851,15 +851,26 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM if (!App.Service.find().someProperty('serviceName', 'RANGER')) { App.config.removeRangerConfigs(this.get('stepConfigs')); } - this.getRecommendationsForDependencies(null, true, function() { - self.setProperties({ - dataIsLoaded: true, - versionLoaded: true, - isInit: false - }); - Em.run.next(function(){ - self.set('hash', self.getHash()) - }); + if (App.isAccessible('MANAGER')) { + this.getRecommendationsForDependencies(null, true, self._onLoadComplete.bind(self)); + } + else { + self._onLoadComplete(); + } + }, + + /** + * @method _getRecommendationsForDependenciesCallback + */ + _onLoadComplete: function () { + var self = this; + this.setProperties({ + dataIsLoaded: true, + versionLoaded: true, + isInit: false + }); + Em.run.next(function(){ + self.set('hash', self.getHash()); }); }, http://git-wip-us.apache.org/repos/asf/ambari/blob/46bf5cb1/ambari-web/app/views/main/host/configs_service.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/host/configs_service.js b/ambari-web/app/views/main/host/configs_service.js index 3415125..3026f25 100644 --- a/ambari-web/app/views/main/host/configs_service.js +++ b/ambari-web/app/views/main/host/configs_service.js @@ -18,13 +18,17 @@ var App = require('app'); App.MainHostServiceConfigsView = Em.View.extend({ + templateName: require('templates/main/host/configs_service'), + didInsertElement: function () { - var controller = this.get('controller'); - controller.loadStep(); + this.get('controller').loadStep(); }, + isConfigsEditable: false, + content: function () { return App.router.get('mainHostDetailsController.content'); }.property('App.router.mainHostDetailsController.content') + }); http://git-wip-us.apache.org/repos/asf/ambari/blob/46bf5cb1/ambari-web/test/controllers/main/service/info/config_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/service/info/config_test.js b/ambari-web/test/controllers/main/service/info/config_test.js index 0fedc6d..10affac 100644 --- a/ambari-web/test/controllers/main/service/info/config_test.js +++ b/ambari-web/test/controllers/main/service/info/config_test.js @@ -1253,4 +1253,30 @@ describe("App.MainServiceInfoConfigsController", function () { }); + describe('#_onLoadComplete', function () { + + beforeEach(function () { + sinon.stub(Em.run, 'next', Em.K); + mainServiceInfoConfigsController.setProperties({ + dataIsLoaded: false, + versionLoaded: false, + isInit: true + }); + }); + + afterEach(function () { + Em.run.next.restore(); + }); + + it('should update flags', function () { + + mainServiceInfoConfigsController._onLoadComplete(); + expect(mainServiceInfoConfigsController.get('dataIsLoaded')).to.be.true; + expect(mainServiceInfoConfigsController.get('versionLoaded')).to.be.true; + expect(mainServiceInfoConfigsController.get('isInit')).to.be.false; + + }); + + }); + });