ChristopherS wrote:
> I am trying to implement an ACL Assert Interface.
> 
> I have a resource "Article."
> An article can be editable by a user *if and only if* the article was
> originally written by the user.
> 
> I would like to use ACL Assert Interface (unless you have other
> suggestions).
> 
> MyAssertion($acl, Zend_Db_Table_Row $row)
> {
>   return ($row->findParentUsers()->getCurrent()->id ==
> Zend_Auth::GetInstance()->getIdentity->id);
> }
> 
> 
> To sum it up, I am passing a DB Table row.  The row is owned by a user.  I
> check to see if the row's owner is the same as the logged in user.  if so,
> assert true.
> 
> Anyway, I get the error that my Assert Interface is not compatible with the
> base class.
> 
> What gives?

I don't understand your code snipper (the function looks like an old
style constructor, but I'm not certain). But either way, all you need is
a class that implements the Zend_Acl_Assert_Interface, which just
involves implementing the assert method with the correct signature.
eg.

class MyAssertion implements Zend_Acl_Assert_Interface
{
    function assert (Zend_Acl $acl, Zend_Acl_Role_Interface $role =
null, Zend_Acl_Resource_Interface $resource = null, $privilege = null) {
        ...
    }
}

If you need to get other data in (such as your $row), you can probably
do it through the constructor or with setters.

-- 

Brenton Alker
PHP Developer - Brisbane, Australia

http://blog.tekerson.com/

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to