cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Gallardo Rivera <agalla...@agsoftware.dnsalias.com>
Subject Re: Authentication framework (sunshine in 2.0.3) and modular database actions
Date Tue, 17 Sep 2002 20:24:51 GMT
Nice question! Its very hairy! :)

I resolved it using this sitemap:

<!--Paginas HTML de Base de Datos -->
      <map:match pattern="*-*.html">
        <map:act type="auth-protect">
		    <map:parameter name="handler" value="agshandler"/>

            <!-- catálogos -->
            <map:match pattern="*-*.html">

                <!-- Crear -->
                <map:match type="request-parameter" 
pattern="cocoon-action-Crear">
                    <map:act action="crear" type="form-validator">
                        <map:parameter name="descriptor" 
value="docs/{../1}-form.xml"/>
                        <map:parameter name="validate-set" value="add"/>
                        <map:act type="dbAdd">
                            <map:parameter name="descriptor" 
value="docs/{../../1}-form.xml"/>
                            <map:parameter name="validate-set" value="add"/>
                            <map:generate src="docs/{../../../1}-confirm.xsp" 
type="serverpages"/>
                            <map:transform src="stylesheets/agssa.xsl"/>
                            <map:serialize/>
                        </map:act>
                    </map:act>
                </map:match>

                <!-- Actualizar -->
                <map:match type="request-parameter" 
pattern="cocoon-action-Guardar">
                    <map:act action="actualizar" type="form-validator">
                        <map:parameter name="descriptor" 
value="docs/{../1}-form.xml"/>
                        <map:parameter name="validate-set" value="update"/>
                        <map:act type="dbUpd">
                            <map:parameter name="descriptor" 
value="docs/{../../1}-form.xml"/>
                            <map:parameter name="validate-set" value="add"/>
                            <map:generate src="docs/{../../../1}-confirm.xsp" 
type="serverpages"/>
                            <map:transform src="stylesheets/agssa.xsl"/>
                            <map:serialize/>
                        </map:act>
                    </map:act>
                </map:match>

                <!-- Borrar -->
                <map:match type="request-parameter" 
pattern="cocoon-action-Borrar">
                    <map:act action="borrar" type="dbDel">
                        <map:parameter name="descriptor" 
value="docs/{../1}-form.xml"/>
                        <map:generate src="docs/{../../1}-confirm.xsp" 
type="serverpages"/>
                        <map:transform src="stylesheets/agssa.xsl"/>
                        <map:serialize/>
                    </map:act>
                    <map:generate src="docs/{1}-{2}.xsp" type="serverpages"/>
                    <map:transform src="stylesheets/agssa.xsl"/>
                    <map:serialize/>
                </map:match>

                <!-- Todo lo demás -->
                <map:match pattern="*-*.html">
                    <map:generate src="docs/{1}-{2}.xsp" type="serverpages"/>
                    <map:transform src="stylesheets/agssa.xsl"/>
                    <map:serialize/>
                </map:match>

           </map:match>
        </map:act>
      </map:match>

I know this is not the best, but it works! ;) The problem with actions-set in 
2.1 is resolved in this way. Just get the lastest CVS.

BTW, I call (like in the tutorial) this sitemap with "cli-crear.html"

cli = clients (a table or form)
crear = create (an action)

I hope it can helps you.

Regards,

Antonio Gallardo.

El Martes, 17 de Septiembre de 2002 12:36, Hugo Burm escribió:
> Hi,
>
> I am running 2.1 dev. I want to feed the result ID of an authentication by
> the authentication framework, into a database query.
>
> I made my own subclass of the non-modular DataseSelectAction and by using
> org.apache.cocoon.webapps.session.components.SessionManager, I could find
> the authentication ID in a sessioncontext and feed it to the select query.
> This is working ok, but it is not an elegant solution because I have to
> modify all database actions and keep them up to date with the current cvs
> version. And these guys are writing code faster than I can compile.
>
> A better solution would be to use the modular database actions. And feed
> the authentication ID into the database action by an input module. In this
> way I could use the unmodified database actions.
>
> I succeeded configuring the input module for "request".  But I need one of
> two other modes:
>
> 1) Sitemap parameter. Can I use a sitemap parameter as the input for an
> input module? How? This sounds trivial, but I could not find out how.
>
> 2) Ideally, I would feed the session context, set up by the authentication
> framework, directly into the database query via the "session" input module.
> I could not find an easy way. It looks like I have to map the xml structure
> of the authentication context, which is stored into the session somehow,
> into a simple session attribute. So this looks like I have to write my own
> input module. I can do that, but any feedback that could point me to the
> right direction would be welcome.
>
>
> Thanks
>
> Hugo
> hugob@datagram.nl
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

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