2010年3月1日星期一

Re: [fw-auth] Re: ACL... but completely different

You could save this type of data at Zend_Auth's storage and read inside the assertion class.

Like:

<?php
class Baz_Acl_Assert_Foo implements Zend_Acl_Assert_Interface
 {
    public function assert(Zend_Acl $acl,
                           Zend_Acl_Role_Interface $role = null,
                           Zend_Acl_Resource_Interface $resource = null,
                           $privilege = null)
    {
        return $this->hasAccess();
    }
   
    protected function_hasAccess()
    {
        $front = Zend_Controller_Front::getInstance();
        $request = $front->getRequest();

        $auth = Zend_Auth::getInstance();   
       
        $foo = $auth->getStorage()->read()->usu_id;
       
        if($foo == 'Owner'){
            return true;
        }
        return false;
    }

 }

Regards,
George

On Mon, Mar 1, 2010 at 3:05 PM, Laura Dean <ldean@saleamp.com> wrote:

I must be missing something with the assertions.  The example given was just
testing an IP address which can be determined by a global variable, but if I
need to test if the user owns the blog post, surely I must pass in the user
id and the id of the blog post?  Is there some way to pass parameters to the
assertions?  I was thinking something like this would be convenient:

$acl->isAllowed('role', 'resource', 'privilege', $params);

Or am I supposed to extend Zend_Acl_Resource so that I can set the id here?
--
View this message in context: http://n4.nabble.com/ACL-but-completely-different-tp1299970p1573971.html
Sent from the Zend Auth mailing list archive at Nabble.com.




--
George Secrieru
51 - 9725 39 29

没有评论: