Re: Problem using Struts-menu with role
Matt Raible <[email protected]>
| Newsgroups | gmane.comp.java.struts-menu.user |
|---|---|
| Message-ID | <[email protected]> |
On Aug 23, 2005, at 11:34 PM, Sunil_Sahu-g6+mqz/[email protected] wrote: > > Hi Matt, > > I am trying to configure struts-menu in my sample applcation but > when i am using "permissons" attribute as "rolesAdapter" in my jsp, > those menu-items in menu-config.xml which have no "roles" attribute > is shown in browser. > > I have configured my menu-config.xml in WEB-INF directory. > Following is the content of menu-config.xml: > > <MenuConfig> > <Displayers> > <Displayer name="ListMenu" > type="net.sf.navigator.displayer.ListMenuDisplayer"/> > </Displayers> > <Menus> > <!-- ==================== Administrator Menu > =========================== --> > <Menu name="AdminMenu" title="menu.admin" > description="Admin Menu" roles="admin"> > <Item name="am.viewUsers" title="menu.admin.users" > page="/blank.jsp"/> > <Item name="ReloadContext" title="menu.admin.reload" > page="/blank1.jsp"/> > </Menu> > <!-- ==================== User Menu > =========================== --> > <Menu name="UserMenu" title="menu.user" description="User > Menu" page="/blank2.jsp" roles="admin,ROLE_USER"/> > <!-- ==================== Upload File Menu > =========================== --> > <Menu name="FileUpload" title="menu.selectFile" > description="File Upload" page="/blank3.jsp"/> > </Menus> > </MenuConfig> > > Following the content of left.jsp where i am using this menu > configuration: > <%@ page language="java" pageEncoding="UTF-8" contentType="text/ > html;charset=utf-8" %> > <%@ taglib uri="http://struts-menu.sf.net/tag-el" prefix="menu" %> > > <div id="menu"> > <menu:useMenuDisplayer name="ListMenu" permissions="rolesAdapter"> > <menu:displayMenu name="AdminMenu"/> > <menu:displayMenu name="UserMenu"/> > <menu:displayMenu name="FileUpload"/> > </menu:useMenuDisplayer> > </div> > > Following entry i have made in my Applicatiion-Context-Security.xml: > <bean id="filterInvocationInterceptor" > class="net.sf.acegisecurity.intercept.web.FilterSecurityInterceptor"> > <property name="authenticationManager"><ref > local="authenticationManager"/></property> > <property name="accessDecisionManager"><ref > local="accessDecisionManager"/></property> > <property name="objectDefinitionSource"> > <value> > CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON > PATTERN_TYPE_APACHE_ANT > /*.jsp=admin,ROLE_USER > </value> > </property> > </bean> > > > In the browser only "FileUpload" menu-items is getting displayed, > rest menu items are not getting displayed when log-on to applicaton > through "admin" rights. > > Is there any other configuration required to run struts-menu with > Role. Where i have to configure "rolesAdapter". I read somewhere > that we should define this "rolesAdapter" in session or request > scope but in Appfuse also i didn't seen anywhere this setting but > in Appfuse it is working fine. > I am stuck now please give me your suggestion. If you're using Acegi, you have to configure a ContextHolderAwareRequestFilter as part of your filterChain bean. This will allow request.isUserInRole() to work. AppFuse does this and calls it remoteUserFilter. Hope this helps, Matt > > Thanks & Regards > Sunil Sahu > Sr. Software Engineer