Ejemplo n.º 1
0
 /**
  * Prüft bei jedem Request die Authentifizierung
  * @param Dragon_Json_Server_Request_Http $request
  */
 public function preDispatch(Dragon_Json_Server_Request_Http $request)
 {
     list($classname, $methodname) = $request->parseMethod();
     if (!$this->_authenticateRequired($classname, $methodname)) {
         return;
     }
     $params = $request->getRequiredParams(array('sessionhash'));
     $logicSession = new DragonX_Account_Logic_Session();
     $recordAccount = $logicSession->getAccount($params['sessionhash']);
     $logicAccount = new DragonX_Account_Logic_Account();
     $logicAccount->requestAccount($recordAccount);
     Zend_Registry::get('Dragon_Plugin_Registry')->invoke('DragonX_Account_Plugin_LoadAccount_Interface', array($recordAccount));
     Zend_Registry::set('recordAccount', $recordAccount);
 }
Ejemplo n.º 2
0
 /**
  * Prüft bei jedem Request ist die Authentifizierung
  * @param Dragon_Json_Server_Request_Http $request
  */
 public function preDispatch(Dragon_Json_Server_Request_Http $request)
 {
     try {
         list($classname, $methodname) = $request->parseMethod();
         $reflectionClass = new Zend_Reflection_Class($classname);
         $tagResource = $reflectionClass->getMethod($methodname)->getDocblock()->getTag('dragonx_acl_resource');
         if (!$tagResource) {
             return;
         }
         $resource = $tagResource->getDescription();
     } catch (Exception $exception) {
         return;
     }
     $resources = array();
     if (Zend_Registry::isRegistered('recordAccount')) {
         $logicAcl = new DragonX_Acl_Logic_Acl();
         $resources = $logicAcl->getResources(Zend_Registry::get('recordAccount'));
     }
     if (!in_array($resource, $resources)) {
         throw new Dragon_Application_Exception_System('missing resource', array('resource' => $resource));
     }
 }