Is it possible to make Sugar Dashboard Uneditable for Regular Users?

 Is it possible to make Sugar Dashboard Uneditable for Regular Users?

Parents Reply Children
  • Hi Nick Gamora

    you can play with the metadata to hide any button

    In your custom code use a debugger to stop the execution and then open the developer tools of chrome to see the buttons metadata

    e.g.

    initialize: function(options) {
            this._super("initialize", [options]);
           // validate user
             if( app.user.get('type')!= "admin" && this.module=="Home"){

                     debugger; // this debugger stops the execution
                  this.meta.buttons[0].buttons = _.filter(this.meta.buttons[0].buttons, function(obj){ return obj.name != 'edit_button'; });
            }
     },

    in the console of chrome execute:

    this.meta.buttons

     

    this instruction will display the metadata of buttons now you need add a line in your code to hide the button that you want similar to:

    this.meta.buttons = _.filter(this.meta.buttons, function(obj){ return obj.name != '<buttonName>'; });

    Regards

     

  • Thank you, Cesar!
    I made this row
    this.meta.buttons[0].buttons = _.filter(this.meta.buttons[0].buttons, function(obj){ return obj.name!='edit_button' && obj.name!='add_button'; });
    and button is hide!!