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

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

Parents
  • Hi Nick Gamora

    yes it is possible, you need to customize the dashboard-headerpane view;
    e.g.
    If you want remove the edit button from metadata you should customize the initialize function to overwrite the buttons
    Like this:

    ....

    initialize: function(options) {

       this._super("initialize", [options]);

       // validate user

       if( app.user.get('type') != "admin" ){

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

      } 

    }

    ...

    Or if you need to show the buttons and prevent the edit action you need to customize the editClicked function.

    e.g.

    editClicked: function(evt) {

       // validate user

       if( app.user.get('type') != "admin" ){

          // here you can show an alert 

          app.alert.show('message-id', {
             level: 'error',
             title: 'You aren't admin'
          });

      } 

      else{

        this._super("editClicked", [evt]);

      }

    }

  • Thank You for the answer, I'm new to working with Sugar 7 dashlet, can you tell which file it is necessary to register?

Reply Children