problem in handling menu - submenu based on spring security

Posted by Nirmal on Stack Overflow See other posts from Stack Overflow or by Nirmal
Published on 2010-12-30T06:56:48Z Indexed on 2010/12/30 10:54 UTC
Read the original article Hit count: 239

Hi All...

I have configured spring security core plugin using requestmap table inside the database..

Now inside requestmap table I have all the possible urls and it's equivalent roles who can access that url...

Now I want to generate menus and submenus based on the urls stored in requestmap table...

So my requirement is to check the urls of menu & submenus against the logged in users privileges... And if logged in user has any one privilege then I need to display that main menu and the available submenus....

For e.g. I have a menu in my project called user which has a following submenus :

**Users (main menu)**
Manage Users (sub menu)
Import Users (sub menu)

Now inside my header.gsp I have successfully achieved the above requirement using if else condition, like :

if ( privs.contains("/users/manageUsers") || privs.contains("/users/importUsers"))

here privs are the list of urls from requestmap table for logged in user.

But I want to achieve these using spring security tag lib, so for comparing urls I have find following tag from spring security core documentation :

<sec:access url="/users/manageUsers">

But i am bit confuse that how I can replace or condition using tag library.. Is there any tag available which checks from multiple urls and evaluate it to true or false ?

Of course I can do using sec:access tag with some flag logic, but is there any tags available which can fulfill my requirement directly ?

Thanks in advance...

© Stack Overflow or respective owner

Related posts about spring

Related posts about grails