Issue Details (XML | Word | Printable)

Key: SM-2
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Matt Raible
Reporter: Tim Morrow
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Struts Menu

VelocityMenuDisplayer only invokes isAllowed() on permissions adapter for one level of child components

Created: 07/Feb/06 01:40 PM   Updated: 22/Aug/07 01:24 PM   Resolved: 10/May/06 12:56 AM
Component/s: Displayers
Affects Version/s: 2.3
Fix Version/s: 2.4

File Attachments: 1. Text File patch.diff (2 kB)



 Description  « Hide
I have a menu with 2 levels of child components. I have a custom permissions adapter. However, I found that when using the VelocityMenuDisplayer, my permissions adapter isAllowed() method was invoked only for the root menu and the next level of components. This meant that certain menu components were always displayed, even if the user shouldn't have had permissions.

Ideally it would invoke isAllowed() for an arbitrary depth of menu components.

I do not have a workaround.



Sort Order: Ascending order - Click to sort in descending order
Tim Morrow added a comment - 07/Feb/06 01:44 PM
Attached a patch which modifies VelocityMenuDisplayer to recurse to all child components, invoking isAllowed() on the permissions adapter.

Note that this patch doesn't alter the existing behavior of modifying the actual menu structure, which is problematic with a servletcontext-scoped menu (i.e. it affects all users).

My recommendation for that is to define a custom session context listener and load the menu into session scope.

Matt Raible added a comment - 10/May/06 12:56 AM
Fixed - thanks!