List Info

Thread: Plugins




Plugins
user name
2007-03-23 18:51:16
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
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )