use
if(user_has_no_rights())
{
   header('HTTP/1.1 401 Unauthorized');// <- robots may need this

   // The following will return the rendered action of that controller
to you.
   echo $this->requestAction('anothercontroller/action',
array('return'));

   $this->autoRender = false;  // Needed to avoid rendering of current
action.
   $this->layout = '';
   die();
}

This will return the rendered view to your current controller that is
been called. Hope this helps,

Ketan

On Sep 4, 10:24 am, snow_raph <[EMAIL PROTECTED]> wrote:
> > Routes.php is exactly for this reason. See in your app/config dir.
> > Also, a more explanation could help, you haven't explained your
> > problem in more details. Give a simple example then perhaps someone
> > could help you better.
>
> ok, I'm in an action of my controller, user has insufficient rights, I
> want to reroute the curent controller/action to another controller/
> action, while returning a 401 header status. Ideally I'd like :
>
> ....controller ....
> if(user_has_no_rights())
> {
>   header('HTTP/1.1 401 Unauthorized');// <- robots may need this
>   stop_current_controller_stuff_and_do('/anothercontroller/action');}
>
> ....controller ....


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to