cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ovidiu Predescu <>
Subject Re: [Proposal] Implementing XMLForm with Flow
Date Tue, 10 Dec 2002 06:40:03 GMT

On Monday, Dec 9, 2002, at 05:21 US/Pacific, Konstantin Piroumian wrote:

> In case of the flow script you should place login() function call in 
> every
> function that needs authorized access, while for the state machine 
> approach
> you could create a superstate - AuthorizedState - for all the 
> sub-states
> that needs authenticated user.

Not really. You can automate this task by arranging in your sitemap to 
call a function that checks the login first, instead of your function. 
The following will do it:


   <map:match pattern="someUri/checkout">
     <map:call function="checkLogin">
       <map:parameter name="funarg" value="checkout"/>


var user;

function login()
   // send the necessary pages for the user
   // to login. Assigns to the global 'user' variable
   // the User object, which is later used throughout
   // the script to identify the user. See the prefs.js
   // sample in Cocoon for an example of such a function.

function checkLogin(funarg)
   if (user == null)

The sitemap calls checkLogin() and passes as argument the function to 
be called when the user has already logged in. The login() function 
will ask the user to login, and will return only when the user 
successfully does so. At that moment the original function to be 
invoked is called.

> In the project I'd been working, we'd been generating our state machine
> descriptions directly from a UML modeling tool (it was XMI format), 
> then it
> were processed by an XSLT to our (simpler) format. (The source code 
> was not
> related to Cocoon neither it was open source, unfortunately)

Having to use a tool is exactly what I'm trying to avoid. I'm finding 
myself in the constant situation of running on an unsupported platform 
for most of such tools. Writing simple scripts beats any time a verbose 
XML document.

Best regards,
Ovidiu Predescu <>

To unsubscribe, e-mail:
For additional commands, email:

View raw message