Yes - Struts 2 is quite a bit easier. Acegi's tag library is already declared in taglibs.jsp, so you only need to use the tags:
<authz:authorize ifAllGranted="ROLE_ADMIN"> Components that are only visible to the users that satisfy the requirements here⦠</authz:authorize> Matt On 6/19/07, Michael Horwitz <[EMAIL PROTECTED]> wrote:
The good news is it is much easier in Struts 2. Just use the Acegi taglibs as already bundled in AppFuse. More details can be found here: http://www.acegisecurity.org/docbook/acegi.html#taglib Mike. On 6/19/07, arvinder <[EMAIL PROTECTED]> wrote: > > What is the best way to accomplish the same thing in struts2? Following > solution is making me envy the JSF folks :) > > mraible wrote: > > > > Here's how to add Acegi JSF support to your project: > > > > 1. Add the acegijsf dependency to your pom.xml (I've uploaded this to > > AppFuse's repository): > > > > <dependency> > > <groupId>net.sf.jsfcomp</groupId> > > <artifactId>acegijsf</artifactId> > > <version>${acegijsf.version }</version> > > </dependency> > > > > 2. Add the property to your pom.xml: > > > > <acegijsf.version>1.1.2</acegijsf.version> > > > > 3. Create acegijsf.taglib.xml in your WEB-INF/taglibs directory (you > > may have to create this): > > > > <?xml version="1.0"?> > > <!DOCTYPE facelet-taglib PUBLIC "-//Sun Microsystems, Inc.//DTD > > Facelet Taglib 1.0//EN" > > "http://java.sun.com/dtd/facelet-taglib_1_0.dtd"> > > <facelet-taglib> > > > > <namespace> http://sourceforge.net/projects/jsf-comp/acegijsf</namespace> > > <tag> > > <tag-name>authorize</tag-name> > > <component> > > > > <component-type> net.sf.jsfcomp.acegijsf.Authorize</component-type> > > </component> > > </tag> > > <tag> > > <tag-name>authentication</tag-name> > > <component> > > > > <component-type>net.sf.jsfcomp.acegijsf.Authentication</component-type> > > </component> > > </tag> > > </facelet-taglib> > > > > 4. Add this file to your web.xml: > > > > <context-param> > > <param-name>facelets.LIBRARIES</param-name> > > <param-value> > > /WEB-INF/taglibs/acegijsf.taglib.xml; > > /WEB-INF/taglibs/corejsf- validator.taglib.xml; > > /WEB-INF/taglibs/tomahawk.taglib.xml > > </param-value> > > </context-param> > > > > 5. In mainMenu.xhtml, add the namespace to <html> and prevent regular > > users from viewing a link: > > > > <html xmlns="http://www.w3.org/1999/xhtml" > > xmlns:c="http://java.sun.com/jstl/core " > > xmlns:f="http://java.sun.com/jsf/core" > > xmlns:h="http://java.sun.com/jsf/html" > > xmlns:ui=" http://java.sun.com/jsf/facelets" > > xmlns:t="http://myfaces.apache.org/tomahawk" > > xmlns:acegi=" http://sourceforge.net/projects/jsf-comp/acegijsf"> > > > > ... > > > > <acegi:authorize ifAllGranted="ROLE_ADMIN"> > > <li> > > <h:commandLink value="#{text['menu.selectFile']}" > > action="selectFile"/> > > </li> > > </acegi:authorize> > > > > I've added this as an issue in JIRA and committed it to SVN for RC1. > > > > http://issues.appfuse.org/browse/APF-816 > > > > Matt > > > > On 6/18/07, jeremiah.lopez <[EMAIL PROTECTED]> wrote: > >> > >> 2.0-M5 > >> > >> > >> mraible wrote: > >> > > >> > What version of AppFuse are you using? > >> > > >> > On 6/18/07, jeremiah.lopez <[EMAIL PROTECTED]> wrote: > >> >> > >> >> Any instruction as to how to configure the filter? Also, you said > >> that > >> >> this > >> >> jar is included in the AppFuse bundle, so I'm assuming I won't need to > >> >> download this. > >> >> > >> >> Thanks, > >> >> Jeremiah > >> >> > >> >> > >> >> mraible wrote: > >> >> > > >> >> > You might try the acegijsf tags that are included in AppFuse: > >> >> > > >> >> > > >> >> > >> http://cagataycivici.wordpress.com/2006/01/19/acegi_jsf_components_hit_the/ > >> >> > > >> >> > I believe they work, but some people have reported problems with > >> them > >> >> > on this list. If you get them to work, please let us know. > >> >> > > >> >> > Matt > >> >> > > >> >> > On 6/18/07, jeremiah.lopez <[EMAIL PROTECTED]> wrote: > >> >> >> > >> >> >> I'm currently editing the mainMenu.xhtml page to include some links > >> >> for > >> >> >> my > >> >> >> application, but the problem I'm having is that some of the links > >> only > >> >> >> need > >> >> >> to be visible and accessible by users with the 'ROLE_ADMIN' role. > >> I > >> >> know > >> >> >> how to do this in the menu-config.xml file, but that only controls > >> the > >> >> >> links > >> >> >> in the menu at the top of the page. I need something like so in > >> >> >> mainMenu.xhtml: > >> >> >> > >> >> >> <c:if test="CHECK IF ADMIN"> > >> >> >> <li> > >> >> >> <h:commandLink value="#{text[' menu.myPage']}" > >> >> >> action="myPage"/> > >> >> >> </li> > >> >> >> </c:if> > >> >> >> > >> >> >> Any ideas? > >> >> >> -- > >> >> >> View this message in context: > >> >> >> > >> >> > >> http://www.nabble.com/Restricting-links-to-admins-tf3942163s2369.html#a11181826 > >> >> >> Sent from the AppFuse - User mailing list archive at Nabble.com. > >> >> >> > >> >> >> > >> --------------------------------------------------------------------- > >> >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> >> >> For additional commands, e-mail: [EMAIL PROTECTED] > >> >> >> > >> >> >> > >> >> > > >> >> > > >> >> > -- > >> >> > http://raibledesigns.com > >> >> > > >> >> > > >> --------------------------------------------------------------------- > >> >> > To unsubscribe, e-mail: [EMAIL PROTECTED] > >> >> > For additional commands, e-mail: [EMAIL PROTECTED] > >> >> > > >> >> > > >> >> > > >> >> > >> >> -- > >> >> View this message in context: > >> >> > >> http://www.nabble.com/Restricting-links-to-admins-tf3942163s2369.html#a11183135 > >> >> Sent from the AppFuse - User mailing list archive at Nabble.com. > >> >> > >> >> --------------------------------------------------------------------- > >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> >> For additional commands, e-mail: [EMAIL PROTECTED] > >> >> > >> >> > >> > > >> > > >> > -- > >> > http://raibledesigns.com > >> > > >> > --------------------------------------------------------------------- > >> > To unsubscribe, e-mail: [EMAIL PROTECTED] > >> > For additional commands, e-mail: [EMAIL PROTECTED] > >> > > >> > > >> > > >> > >> -- > >> View this message in context: > >> http://www.nabble.com/Restricting-links-to-admins-tf3942163s2369.html#a11183190 > >> Sent from the AppFuse - User mailing list archive at Nabble.com. > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > > > -- > > http://raibledesigns.com > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > -- > View this message in context: http://www.nabble.com/Restricting-links-to-admins-tf3942163s2369.html#a11193138 > Sent from the AppFuse - User mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
-- http://raibledesigns.com
