-- maxarbos <[EMAIL PROTECTED]> wrote
(on Thursday, 10 July 2008, 10:34 AM -0700):
> yeah, that was what I was thinking, but now how do you implelemnt it?
> 
> When we were using the MVC, the controller and action where declared in the
> url and the mvc took care of breaking that up and the acl determined which
> resource had which priv.
> 
> So when I have a class 'User.php' with methods such as: 'editAccount',
> 'addNumber', etc...  do I just need to now include Zend_ACL_Resoure in the
> construct and assign a name to the class like :
> 
> __construct($resource) {
>    new Zend_Acl_Resource->getResourceId('user');
> }
> 
> 
> Do the methods still need to be named 'editAction', 'addnumberAction'?
> 
> I'm just a little unclear how to register the classes as resources I guess.

Resources are, quite simply, just names. So, it's pretty easy:

  * Define your resources (classes)
  * Assign rights (method names) to resources (classes) per role

Then, in your methods, you could do something like:

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

(assuming that $this->acl is your Zend_Acl object, and $this->user is a
user corresponding to a role in the ACL list)

Read through the Zend_Acl manual pages -- they make no mention of MVC,
and should help clarify what I'm getting at.


> Matthew Weier O'Phinney-3 wrote:
> > 
> > -- maxarbos <[EMAIL PROTECTED]> wrote
> > (on Thursday, 10 July 2008, 09:05 AM -0700):
> >> Is ti possible to run Zend_ACL without the MVC portion?
> >> I also need it to work with a pretty much all ajax type site.
> > 
> > Zend_Acl is a standalone component and has no ties to the MVC. Use it
> > however you desire. :)
> > 
> > -- 
> > 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-tp18385583p18388057.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
> 

-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend Framework           | http://framework.zend.com/

Reply via email to