/** * @return OpenSKOS_Db_Table_Row_User */ protected function _getUser() { $apikey = $this->getRequest()->getParam('key'); if (!$apikey) { throw new Zend_Controller_Action_Exception('No key specified', 412); } $user = OpenSKOS_Db_Table_Users::fetchByApiKey($apikey); if (null === $user) { throw new Zend_Controller_Action_Exception('No such API-key: `' . $apikey . '`', 401); } if (!$user->isApiAllowed()) { throw new Zend_Controller_Action_Exception('Your user account is not allowed to use the API', 401); } if ($user->active != 'Y') { throw new Zend_Controller_Action_Exception('Your user account is blocked', 401); } return $user; }