You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Stewart, Gary" <Ga...@luht.scot.nhs.uk> on 2006/03/29 11:09:00 UTC

User Roles and Flowscript

Hi there,

I've been working with the authentication resource for a while but I figured it was about time I implemented per role pipelines (that is some pipelines can only be accessed by some roles). I am using flowscript to do this but I don't seem to be able to get it to work. The pipeline performs an authentication check (I figure this would give me the session information; or is there something I need to do in the flow?). In the Javascript I quite simply have:

function administratorOnlyPage()
{
 var resource = cocoon.parameters.resourceRequest;
 if(cocoon.request.isUserInRole("Administrator"))
 {
  cocoon.sendPage(resource);
 }
 else
 {
  cocoon.sendPage("access-denied");
 }
}

I've checked the user role on another page and it appears that they are an administrator. Is there something I'm missing? Do I need to define the roles?

Sorry to bother and thanks,

Gary

*****************************************************************
The information contained in this message may be confidential or 
legally privileged and is intended for the addressee only. If you 
have received this message in error or there are any problems 
please notify the originator immediately. The unauthorised use, 
disclosure, copying or alteration of this message is 
strictly forbidden.
*****************************************************************


If you work for NHS Lothian and wish to have help to stop smoking, support is available by contacting stopsmoking.staff@lpct.scot.nhs.uk or 0131 537 9494  - internal 49494.  For anyone else living/working in Lothian, please contact 0800 848484 for your nearest NHS stop smoking service.


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


Re: User Roles and Flowscript

Posted by Wadim Kruse <z-...@web.de>.
Stewart, Gary wrote:
> Hi there,
> 
> I've been working with the authentication resource for a while but I figured it was about time I implemented per role pipelines (that is some pipelines can only be accessed by some roles). I am using flowscript to do this but I don't seem to be able to get it to work. The pipeline performs an authentication check (I figure this would give me the session information; or is there something I need to do in the flow?). In the Javascript I quite simply have:
> 
> function administratorOnlyPage()
> {
>  var resource = cocoon.parameters.resourceRequest;
>  if(cocoon.request.isUserInRole("Administrator"))
>  {
>   cocoon.sendPage(resource);
>  }
>  else
>  {
>   cocoon.sendPage("access-denied");
>  }
> }
> 
> I've checked the user role on another page and it appears that they are an administrator. Is there something I'm missing? Do I need to define the roles?
> 
> Sorry to bother and thanks,
> 
> Gary
> 
> *****************************************************************
> The information contained in this message may be confidential or 
> legally privileged and is intended for the addressee only. If you 
> have received this message in error or there are any problems 
> please notify the originator immediately. The unauthorised use, 
> disclosure, copying or alteration of this message is 
> strictly forbidden.
> *****************************************************************
> 
> 
> If you work for NHS Lothian and wish to have help to stop smoking, support is available by contacting stopsmoking.staff@lpct.scot.nhs.uk or 0131 537 9494  - internal 49494.  For anyone else living/working in Lothian, please contact 0800 848484 for your nearest NHS stop smoking service.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 

Hi Gary,

this might help you:
http://wiki.apache.org/cocoon/AuthFWWithFlow

It didn't help me. I have the same problem like in 
http://www.planetcocoon.com/node/1879

However, you can use something like this:

<map:parameter name="userid"		 
value="{session-context:authentication/authentication/ID}" />

when you call your javaflow function, and

var uid = cocoon.parameters["userid"];

in your javaflow.

Regards,
Wadim






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