Nirmal
Nirmal

Reputation: 4829

Control Menu Items based on Privileges of Logged In User with spring security

Based on this link I have incorporated the spring security core module with my grails project... I am using the Requestmap concept by storing each role, user and requestmap inside the database only...

Now my requirement is to provide the menu items based on the users assigned roles... For e.g.:

If my "User" Main Menu have following Items : Dashboard Import User Manage User

And if I have assigned a roles of Dashboard and Import User to the user with a username "auditor" then, only following Menu items should be displayed on the screen : User (Main Menu) -> Dashboard (sub menu) -> Import User (sub menu)

I have explored the Spring Security ACL plugin for the same, but it's using the Domain classes to get it working...

So, wanted to know the convenient way to do so...

Thanks in advance...

Upvotes: 1

Views: 1147

Answers (1)

Burt Beckwith
Burt Beckwith

Reputation: 75681

The ACL plugin seems like overkill. I'd use the taglib that comes with the plugin; see section "6.1 SecurityTagLib" in the docs.

Wrap the code in the GSP that renders the submenus with <sec:ifAllGranted roles="...">menu code here</sec:ifAllGranted>

Upvotes: 2

Related Questions