i have been away the past few days, thank you all for your help.

I guess if a whole class is locked out, couldn't I include:

            if (!$this->acl->isAllowed($this->user, __CLASS__)) {
                throw new Exception('Access denied');
            }

in the __construct then if things need finer grained control, to add that
check to each method?




Matthew Weier O'Phinney-3 wrote:
> 
> 
> The other possibility is to make those methods protected and prefix them
> with a '_', and add proxying via __call():
> 
>     protected function _echoHello()
>     {
>         echo 'Hello!';
>     }
> 
>     public function __call($method, $args)
>     {
>         if (method_exists($this, '_' . $method)) {
>             if (!$this->acl->isAllowed($this->user, __CLASS__, $method)) {
>                 throw new Exception('Access denied');
>             }
>             return call_user_func_array(array($this, '_' . $method),
> $args);
>         }
> 
>         throw new Exception(sprintf('Invalid method "%s"', $method));
>     }
> 
> Any method that doesn't need ACL checks can then simply be declared
> public.
> 
> This _will_ have a performance hit (both from overloading and from using
> call_user_func_array()), but it will automate things.
> 
> 
> -- 
> Matthew Weier O'Phinney
> Software Architect       | [EMAIL PROTECTED]
> Zend Framework           | http://framework.zend.com/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Is-it-possible-to-use-Zend_ACL-without-MVC-tp18385583p18468080.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to