コード例 #1
0
ファイル: Owner.php プロジェクト: BGCX262/zym-svn-to-git
 /**
  * Assert if the current user is either the owner of the resource, or an
  * administrator
  *
  * @param Zend_Acl $acl
  * @param Zend_Acl_Role_Interface $role
  * @param Zend_Acl_Resource_Interface $resource
  * @param string $privilege
  * @return bool
  */
 public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null, Zend_Acl_Resource_Interface $resource = null, $privilege = null)
 {
     if ($acl->getRole() == $this->getAdminRole()) {
         return true;
     }
     $creatorColumn = $this->getCreatorColumn();
     // Very simple check to match identity credentials to database row
     // TODO: remove hardcoding for id?
     return $acl->getIdentity()->id == $resource->{$creatorColumn};
 }