You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rz...@apache.org on 2015/12/10 23:38:22 UTC

ambari git commit: AMBARI-14314. RBAC: Alert state is not visible for non-admin roles (rzang)

Repository: ambari
Updated Branches:
  refs/heads/trunk 3559218e3 -> 2b0cb8062


AMBARI-14314. RBAC: Alert state is not visible for non-admin roles (rzang)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2b0cb806
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2b0cb806
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2b0cb806

Branch: refs/heads/trunk
Commit: 2b0cb80629243d01a4723a2b5f43da7d9604eaba
Parents: 3559218
Author: Richard Zang <rz...@apache.org>
Authored: Thu Dec 10 14:35:28 2015 -0800
Committer: Richard Zang <rz...@apache.org>
Committed: Thu Dec 10 14:35:28 2015 -0800

----------------------------------------------------------------------
 ambari-web/app/templates/main/alerts.hbs | 10 ++++++++++
 ambari-web/app/utils/helper.js           | 12 ++++++++++++
 2 files changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2b0cb806/ambari-web/app/templates/main/alerts.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/alerts.hbs b/ambari-web/app/templates/main/alerts.hbs
index e2028be..45abed7 100644
--- a/ambari-web/app/templates/main/alerts.hbs
+++ b/ambari-web/app/templates/main/alerts.hbs
@@ -71,6 +71,11 @@
                   </span>
                   </a>
                 {{/isAuthorized}}
+                {{#isNotAuthorized "CLUSTER.TOGGLE_ALERTS"}}
+                    <span {{bindAttr class="alertDefinition.enabled:alert-definition-enable:alert-definition-disable"}}>
+                      {{view.enabledDisplay}}
+                    </span>
+                {{/isNotAuthorized}}
               {{else}}
                 {{#isAuthorized "CLUSTER.TOGGLE_ALERTS"}}
                   <a href="#" {{action "toggleState" alertDefinition target="controller"}} {{bindAttr class="alertDefinition.enabled:alert-definition-enable:alert-definition-disable"}}>
@@ -79,6 +84,11 @@
                   </span>
                   </a>
                 {{/isAuthorized}}
+                {{#isNotAuthorized "CLUSTER.TOGGLE_ALERTS"}}
+                  <span {{bindAttr class="alertDefinition.enabled:alert-definition-enable:alert-definition-disable"}}>
+                    {{view.disabledDisplay}}
+                  </span>
+                {{/isNotAuthorized}}
               {{/if}}
             </td>
           </tr>

http://git-wip-us.apache.org/repos/asf/ambari/blob/2b0cb806/ambari-web/app/utils/helper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/helper.js b/ambari-web/app/utils/helper.js
index 3e7caed..511656d 100644
--- a/ambari-web/app/utils/helper.js
+++ b/ambari-web/app/utils/helper.js
@@ -372,6 +372,18 @@ Em.Handlebars.registerHelper('isAuthorized', function (property, options) {
   return Ember.Handlebars.helpers.boundIf.call(permission, "isAuthorized", options);
 });
 
+Em.Handlebars.registerHelper('isNotAuthorized', function (property, options) {
+  var permission = Ember.Object.create({
+    isNotAuthorized: function() {
+      return !App.isAuthorized(property);
+    }.property('App.router.wizardWatcherController.isWizardRunning')
+  });
+
+  // wipe out contexts so boundIf uses `this` (the permission) as the context
+  options.contexts = null;
+  return Ember.Handlebars.helpers.boundIf.call(permission, "isNotAuthorized", options);
+});
+
 /**
  * @namespace App
  */