• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

displaying selective tabs in JSP based on access rights

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a task. I have a few tabs in Jsp, while clicking on each, takes to different page. I need to display the tabs based on the rights that a logged in user's role has. For eg, if the user does not have the right to update, the update tab should not be displayed. I would appreciate if any one could give me an idea about how to do it.

Thanks,
Shiny.
 
Sheriff
Posts: 67695
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Conditionals in a JSP can be easily handle with the JSTL tags <c:if>, or <c:choose> with c:when> and <c:otherwise>.

Or, the controller can send a list of the tabs to be displayed to the page based upon the user rights.
 
Shiny Suresh
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the prompt response. I will try it.

 
Shiny Suresh
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am supposed to be displaying based on the user's rights using Spring's <security:authorize> tag.



I have this right AUTHORITY_GENERAL_INQUIRY. But still the tab does not get displayed. I tried changing ifAllGranted to ifNotGranted, the tab displays.
How do I check what authorities the user has? We use ldap for authentication and authorization.
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well for starters the tag you are using are deprecated.

https://github.com/SpringSource/spring-security/blob/master/taglibs/src/main/resources/META-INF/security.tld

I would go ahead and start using access




You can check the stuff you are asking about server side, maybe in your controller.

 
Shiny Suresh
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks for your response. I did a workaround, by using <c:if > and checking the permissions. Probably <security:authorize> didn't work for me because it is deprecated, like you said.
Appreciate your help.

Thanks,
Shiny.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic