You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Derek Hohls <DH...@csir.co.za> on 2004/07/14 11:27:12 UTC
RE: Authentication - accessing user info in
JXTemplateGenerator?
Thanks, Helma
I don't want to use flowscript at this time, so I will
try the first method,
I assume mypage.jx start as template generator and
gets passed through a CInclude Transformer at some
stage as well??
But I am not sure how you get the actual user ID from
the authentication session info - get User seems to
be accessing the entire file??
Derek
>>> H.vanderLinden@MI.unimaas.nl 2004/07/14 11:03:52 AM >>>
Hi,
I remember I've tried this too, but I can't remember I succeeded. What
I now
do is include the info using a CInclude transformer and generating the
necessary info in another pipeline. A final XSL transformer cleans up
the
resulting XML before it is transformed to HTML.
mypage.jx:
<cinclude:include src="cocoon:/getUser"/>
pipeline:
<map:match pattern="getUser">
<map:generate src="system/authentication.xml">
<map:parameter name="use-request-parameters"
value="true"/>
</map:generate>
<map:transform type="session"/>
<map:serialize type="xml"/>
</map:match>
authentication.xml:
<?xml version="1.0" encoding="UTF-8"?>
<authentication xmlns:session="http://apache.org/cocoon/session/1.0"
>
<session:getxml context="authentication" path="/"/>
</authentication>
Maybe not the most elegant/fastest solution, but it works.
Some random thoughts:
- get the info in a flowscript and add it to the template using the
bizData
construction:
function showInfo() {
var userid =
cocoon.session.getContext("/authentication/authentication/ID"); //
making up
the syntax ;-)
var viewData = { ID: userid };
cocoon.sendPage("myJXpipeline", viewData);
}
mypage.jx includes a reference to ${ID}.
HTH.
Bye, Helma
> -----Original Message-----
> From: Derek Hohls [mailto:DHohls@csir.co.za]
> Sent: Wednesday, 14 July 2004 10:31
> To: users@cocoon.apache.org
> Subject: Authentication - accessing user info in
JXTemplateGenerator?
>
>
> I am trying to access the user information, after login,
> in a JXTemplate Generator page, which is *not* called
> by any flow...
>
> I have tried:
> #{cocoon/session/context/authentication/authentication/ID}
> and
> #{cocoon/session-context/authentication/authentication/ID}
>
> I have also tried passing the info, from within the sitemap,
> as parameters:
>
> <map:generate type="jx" src="docs/mypage.jx">
> <map:parameter name="userID"
> value="{session-context:authentication/authentication/ID}"/>
> </map:generate>
>
> And then accessing the parameter as follows:
>
> #{cocoon/parameters/userID}
> and
> ${cocoon.parameters.getAttribute('userID')}
>
> But without any success... if anyone can point me
> to the right syntax, or appropriate method, I would
> appreciate it!
>
> Thanks
> Derek
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
> MailScanner thanks transtec Computers for their support.
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org