Search code examples
user-interfacegwtrolesuibinder

TabLayoutPanel - Show tabs based on roles


I'm developing a GWT-Application where the navigation is mainly a TabLayoutPane, where each Tab represents a different functionality. What I need is to only show tabs the user is allowed to see (each user has a role like user or admin).

The problem is I don't know how to achieve this, especially with UIBinder.

Here's what I thought of:

  1. Don't use UIBinder and build the TabLayoutPanel programmatically.
  2. Use UIBinder and just hide certain tabs based on each users role (which sounds like it would be quite inefficient).

Or are there better ways to achieve something like this?


Solution

  • I would go with approach number one as it is much cleaner, imho. However, make sure that you don't use it as security feature and don't show any sensitive information that non admin is not allowed to see. Since all construction will occur in javascript in the browser, it will be fairly simple to fool browser into showing admin tabs without appropriate authorization.