-- Sadri Sahraoui <[EMAIL PROTECTED]> wrote
(on Saturday, 24 March 2007, 09:33 AM +0300):
> Hi,
> just use the $request methods (Zend_Controller_Request_Abstract)
> $request->setModuleName($newmodule);
> $request->setControllerName($newcontroller);
> $request->setActionName($newaction);
>
> $request->setDispatched(true); // I don't know if this is required,
> I haven't see any effect
You want $request->setDispatched(false) -- this tells the dispatch loop
that it needs to discard the current action and use the new one just
specified.
Also, the above methods all implement a fluent interface -- try this
instead, simply for redability and simplicity:
$request->setModuleName($newModule)
->setControllerName($newController)
->setActionName($newAction)
->setDispatched(false);
> On 3/24/07, Ian Warner <[EMAIL PROTECTED]> wrote:
> >Hi
> >
> >I have written a plugin to check against an ACL list and provide a
> >boolean response as to whether the user can at least view the desired page.
> >
> >$controller->setControllerDirectory(array(
> > 'default' => $config->controller . 'controllers',
> > 'users' => 'modules/users/controllers'))
> > ->registerPlugin(new Zend_Plugin_Auth())
> > ->throwExceptions(true);
> >
> >In plugin truncated:
> >
> > public function preDispatch($request)
> > {
> > // Simply see if the User Type can view this page.
> > $access = $acl->isAllowed($type,
> >$request->getParam('controller'), 'view');
> >
> > if (!$access) {
> > //echo 'No Access';
> > return false;
> > } else {
> > //echo 'Access';
> > return true;
> > }
> >
> >
> >Now my issue is how do I then translate this into the controller to
> >allow access or redirect away from the desired controller/action.
> >
> >My other issue is caching the ACL list of something so that it isnt
> >generated on each subsequent request, I can see something about
> >serialised PHP in the manul but no concrete instructions are given on
> >best practices.
> >
> >Any tutorial links on this welcome, but a lot of them on the net are now
> >quite old and dont use 0.8+
> >
> >Cheers
> >
> >Ian
> >
> >
>
--
Matthew Weier O'Phinney
PHP Developer | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/