views:

75

answers:

1

Hi,

i have an custom widget in dojo. My Problem is to check some kind of access rules wich are passed to the widget.

if check the rules after the widget is fully loaded everything works fine. But i have to remove some text and buttons before it is displayed.

I've tryted the startup, and postcreate hook (-: is there something like "aftercreate" ?

A: 

The first solution I can think of is to begin with hiding the restricted elements and then remove them.

In css:

.hidden{ display: none }

In widget's template for all permissions-sensitive elements:

<div class="${permissionsSensitiveElementsClass}">...</div>

In widget's code:

permissionsSensitiveElementsClass: "",
postMixInProperties: function(){
  if(!this.hasPermissions()){
    this.permissionsSensitiveElementsClass = "hidden";
  }
  this.inherited(arguments);
},
startup: function(){
  // remove elements if necessary
},
hasPermissions: function(){
  // permissions check
},
Kniganapolke