You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2015/06/02 13:57:12 UTC
ambari git commit: AMBARI-11609. User with Read-Only access can't
visit service configs page (onechiporenko)
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 <on...@apache.org>
Authored: Tue Jun 2 14:10:28 2015 +0300
Committer: Oleg Nechiporenko <on...@apache.org>
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;
+
+ });
+
+ });
+
});