Browse Source

AMBARI-24853 Cluster user can't modify shared widgets

Andrii Tkach 7 years ago
parent
commit
4160fed725
1 changed files with 3 additions and 2 deletions
  1. 3 2
      ambari-web/app/mixins/common/widgets/widget_mixin.js

+ 3 - 2
ambari-web/app/mixins/common/widgets/widget_mixin.js

@@ -677,7 +677,7 @@ App.WidgetMixin = Ember.Mixin.create({
    */
    */
   editWidget: function (event) {
   editWidget: function (event) {
     var self = this;
     var self = this;
-    var isShared = this.get('content.scope') == 'CLUSTER';
+    var isShared = this.get('content.scope') === 'CLUSTER';
     if (!isShared) {
     if (!isShared) {
       self.get('controller').editWidget(self.get('content'));
       self.get('controller').editWidget(self.get('content'));
     } else {
     } else {
@@ -686,7 +686,8 @@ App.WidgetMixin = Ember.Mixin.create({
         bodyClass: Em.View.extend({
         bodyClass: Em.View.extend({
           template: Ember.Handlebars.compile('{{t widget.edit.body}}')
           template: Ember.Handlebars.compile('{{t widget.edit.body}}')
         }),
         }),
-        primary: Em.I18n.t('widget.edit.button.primary'),
+        primary: App.isAuthorized('CLUSTER.MANAGE_WIDGETS') ? Em.I18n.t('widget.edit.button.primary') : null,
+        secondaryClass: App.isAuthorized('CLUSTER.MANAGE_WIDGETS') ? 'btn-default' : 'btn-success',
         secondary: Em.I18n.t('widget.edit.button.secondary'),
         secondary: Em.I18n.t('widget.edit.button.secondary'),
         third: Em.I18n.t('common.cancel'),
         third: Em.I18n.t('common.cancel'),
         onPrimary: function () {
         onPrimary: function () {