cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephan Michels <step...@apache.org>
Subject Re: Cocoon and security
Date Tue, 13 May 2003 14:05:00 GMT



On Tue, 13 May 2003, Chris Pratt wrote:

>
>
> > Can some one point me at a decent site with a clear explanation for
> > security / authorization of a site:
> >
> > I have the follwoing in my tomcat-users.xml:
> >
> > <tomcat-users>
> >   <role rolename="admin"/>
> >   <role rolename="operator"/>
> >   <user username="admin" password="admin" roles="admin"/>
> >   <user username="operator" password="operator" roles="operator"/>
> > <tomcat-users>
> >
> > It is easy to tell everyone who can login to go everywhere however:
> > I want to direct those that log on as admin to one place in my site , and
> > operators to another; I have found the following to put in my sitemap.xml
> >
> > <map:match pattern="">
> > <map:select type="parameter">
> > <map:parameter name="parameter-selector-test" value="{../ID}"/>
> > <map:when test="admin">
> >  	<map:generate type="file" src="docs/cphome.xml"/>
> > 	<map:transform type="xslt" src="xslt/simple-page2html.xsl"/>
> > 	<map:serialize type="html"/>
> > 	<map:parameter >name="use-request-parameters" value="true"/>
> > </map:when>
> > <map:when test="operator">
> >  	<map:generate type="file" src="docs/cphomeall.xml"/>
> > 	<map:transform type="xslt" src="xslt/simple-page2html.xsl"/>
> > 	<map:serialize type="html"/>
> > 	<map:parameter >name="use-request-parameters" value="true"/>
> > </map:when>
> >  </map:select>
> > </map:match>
> >
> > But this doesn't work either.... and I am not sure where in the site map a
> > handler goes and no idea what  value="{../ID}" is.
> > Anyway I am sure this should not be this hard, all I want to do is have a
> > couple of people login in if they are admin go here, if operators go there
> > Chris

Write your own selector, which tests if the user have a
special role which request.isUserInRole.

public class UserRoleSelector implements Selector {

    boolean select (String expression, Map objectModel, Parameters
parameters) {

        return ObjectModelHelper.getRequest(objectModel).isUserInRole(expression);
    }
}

Stephan.


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Mime
View raw message