original_string: protected function _checkAcl($object, $function)
      {
          if(!$this->_acl) {
              return true;
          }
          if($object) {
              $class = is_object($object)?get_class($object):$object;
              if(!$this->_acl->has($class)) {
                  require_once 'Zend/Acl/Resource.php';
                  $this->_acl->add(new Zend_Acl_Resource($class));
              }
              $call = array($object, "initAcl");
              if(is_callable($call) && !call_user_func($call, $this->_acl)) {
                  // if initAcl returns false, no ACL check
                  return true;
              }
          } else {
              $class = null;
          }
  
          $auth = Zend_Auth::getInstance();
          if($auth->hasIdentity()) {
              $role = $auth->getIdentity()->role;
          } else {
              if($this->_acl->hasRole(Zend_Amf_Constants::GUEST_ROLE)) {
                  $role = Zend_Amf_Constants::GUEST_ROLE;
              } else {
                  require_once 'Zend/Amf/Server/Exception.php';
                  throw new Zend_Amf_Server_Exception("Unauthenticated access not allowed");
              }
          }
          if($this->_acl->isAllowed($role, $class, $function)) {
              return true;
          } else {
              require_once 'Zend/Amf/Server/Exception.php';
              throw new Zend_Amf_Server_Exception("Access not allowed");
          }
      }
code: protected function _checkAcl($object, $function)
      {
          if(!$this->_acl) {
              return true;
          }
          if($object) {
              $class = is_object($object)?get_class($object):$object;
              if(!$this->_acl->has($class)) {
                  require_once 'Zend/Acl/Resource.php';
                  $this->_acl->add(new Zend_Acl_Resource($class));
              }
              $call = array($object, "initAcl");
              if(is_callable($call) && !call_user_func($call, $this->_acl)) {
                  // if initAcl returns false, no ACL check
                  return true;
              }
          } else {
              $class = null;
          }
  
          $auth = Zend_Auth::getInstance();
          if($auth->hasIdentity()) {
              $role = $auth->getIdentity()->role;
          } else {
              if($this->_acl->hasRole(Zend_Amf_Constants::GUEST_ROLE)) {
                  $role = Zend_Amf_Constants::GUEST_ROLE;
              } else {
                  require_once 'Zend/Amf/Server/Exception.php';
                  throw new Zend_Amf_Server_Exception("Unauthenticated access not allowed");
              }
          }
          if($this->_acl->isAllowed($role, $class, $function)) {
              return true;
          } else {
              require_once 'Zend/Amf/Server/Exception.php';
              throw new Zend_Amf_Server_Exception("Access not allowed");
          }
      }
code_tokens: protected function _checkAcl ( $ object , $ function ) { if ( ! $ this -> _acl ) { return true ; } if ( $ object ) { $ class = is_object ( $ object ) ? get_class ( $ object ) : $ object ; if ( ! $ this -> _acl -> has ( $ class ) ) { require_once 'Zend/Acl/Resource.php' ; $ this -> _acl -> add ( new Zend_Acl_Resource ( $ class ) ) ; } $ call = array ( $ object , "initAcl" ) ; if ( is_callable ( $ call ) && ! call_user_func ( $ call , $ this -> _acl ) ) { // if initAcl returns false, no ACL check return true ; } } else { $ class = null ; } $ auth = Zend_Auth :: getInstance ( ) ; if ( $ auth -> hasIdentity ( ) ) { $ role = $ auth -> getIdentity ( ) -> role ; } else { if ( $ this -> _acl -> hasRole ( Zend_Amf_Constants :: GUEST_ROLE ) ) { $ role = Zend_Amf_Constants :: GUEST_ROLE ; } else { require_once 'Zend/Amf/Server/Exception.php' ; throw new Zend_Amf_Server_Exception ( "Unauthenticated access not allowed" ) ; } } if ( $ this -> _acl -> isAllowed ( $ role , $ class , $ function ) ) { return true ; } else { require_once 'Zend/Amf/Server/Exception.php' ; throw new Zend_Amf_Server_Exception ( "Access not allowed" ) ; } }
docstring: Check if the ACL allows accessing the function or method
  
  @param string|object $object Object or class being accessed
  @param string $function Function or method being accessed
  @return unknown_type
docstring_tokens: Check if the ACL allows accessing the function or method