Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hide resources according user permissions

 
Mariano Javier
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i'm developening a struts application and i want to make my jsp according users permissions. For example i would like to hide a link to another jsp if the user doesn't have permission to see it.

Does anyone know a pattern or a tag lib to do this automatically? i'm looking for a better way than calling a method (something like isAuthorized() ) from a created object inside every jsp i have.
I also don't want every link in my jsp beeing inside an if statement.

Thanks in advance.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One possible solution might be to develop your own custom tag that encapsulates your authorization logic. Example:

I know you said you didn't want everything inside an if statement, but there has to be some conditional logic in there somewhere. At least with a custom tag it's more readable.
[ October 20, 2007: Message edited by: Merrill Higginson ]
 
Mariano Javier
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much, i'll try to develop s jsp tags as you reccomend.
 
John Melton
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Merrill makes the correct suggestion. You could also use some existing libraries such as logic resent and logic:equals to accomplish the same thing if you're not keen on creating custom taglibs. Just a thought. However, the custom library is the right way to go if you have the time.
Hope this helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic