For those us that might encounter this need for somewhat simple situations,
why not use a @UiFactory? That provides a reasonably clean solution that
separates the security aspects.
Provide a parameter like "roles" to the create method, which could parse a
comma-separated list of roles in a string to determine whether to show or
hide.
<g:FlowPanel>
<g:TextBox addStyleNames="test" ui:field="txtA"
roles="admin,sales"/>
<g:TextBox addStyleNames="test" ui:field="txtB" roles="guest"/>
</g:FlowPanel>
@UiFactory
public TextBox create(String roles) {
TextBox txtBox = new TextBox();
txtBox.setVisible(Roles.hasAccess(roles));
return txtBox;
}
}
Roles would know the current user role(s) and determine if one of the roles
in the user matches one of the valid roles for the widget.
It would be nice if the UiFactory methods could somehow be separated out
into their own class for reuse, but I don't think that's possible.
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.