/**
  * {@inheritdoc}
  */
 public function dispatch(RequestInterface $request, ResponseInterface $response = null)
 {
     if (!$request instanceof ConsoleRequest) {
         throw new InvalidArgumentException(sprintf('%s can only dispatch requests in a console environment', get_called_class()));
     }
     return parent::dispatch($request, $response);
 }
 /**
  * {@inheritdoc}
  * @param RequestInterface $request
  * @param ResponseInterface $response
  * @return mixed|ResponseInterface
  * @throws \RuntimeException
  */
 public function dispatch(RequestInterface $request, ResponseInterface $response = null)
 {
     if (!$request instanceof ConsoleRequest) {
         throw new \RuntimeException('You can use this controller only from a console!');
     }
     return parent::dispatch($request, $response);
 }
Exemple #3
0
 /**
  * Dispatch is called before the action, using this to make sure any request to the app without an authenticated
  * user is directed to the signin,
  *
  * @param Request $request
  * @param Response $response
  * @return mixed|\Zend\Http\Response|Response
  */
 public function dispatch(Request $request, Response $response = null)
 {
     $this->user = ParseUser::getCurrentUser();
     if (!$this->user or !isset($_SESSION['todo']['user']) or $this->user->getUsername() !== $_SESSION['todo']['user']) {
         return $this->redirect()->toRoute('auth', ['action' => 'signin']);
     }
     return parent::dispatch($request, $response);
     // TODO: Change the autogenerated stub
 }
 /**
  * Antes de chamar o metodo original setamos as variaveis que vao para o layout
  * como a cor padrao para o fundo do site.
  * 
  * @param RequestInterface $request
  * @param ResponseInterface $response
  */
 public function dispatch(Request $request, Response $response = null)
 {
     // Verifica permissao de acesso.
     if (!$this->checkAccess($request)) {
         return $this->redirect()->toRoute("ajax/access-denied");
     }
     // Segue ritmo normal do dispatch
     return parent::dispatch($request, $response);
 }
 function dispatch(Request $request, Response $response = null)
 {
     if (php_sapi_name() == 'cli') {
         return parent::dispatch($request, $response);
     }
     // ensure the singleton is loaded & seeded with DB for code that depends on it
     $this->getServiceLocator()->get('vfsingleton');
     if ($this->thisControllerRequiresLoginToView && !isset($_SESSION['logged_in'])) {
         return $this->redirect()->toRoute('login');
     }
     return parent::dispatch($request, $response);
 }
 /**
  * Antes de chamar o metodo original setamos as variaveis que vao para o layout
  * como a cor padrao para o fundo do site.
  * 
  * @param RequestInterface $request
  * @param ResponseInterface $response
  */
 public function dispatch(RequestInterface $request, ResponseInterface $response = null)
 {
     // Gerenciamento de permissao de acesso
     $accessControl = AccessControl::getInstance($this->getModuleName());
     $accessControl->setupPermissions($this->getLogin() ? $this->getLogin()->getFkRole() : Config::getZf2libConfig('roleDefault'), $this->getModuleName());
     // Verifica se usuario tem acesso ao controlador e acao requisitado
     if (!$this->checkAccess()) {
         if (!$this->getLogin()) {
             $module = $this->getModuleName() == 'application' ? '' : $this->getModuleName();
             return $this->redirect()->toUrl('/' . $module . '/auth/login');
         } else {
             // Adiciona mensagem e redireciona
             $this->addLayoutMessage("Acesso negado", Enum\MsgType::WARNING, true);
             return $this->initRedirect();
         }
     }
     // Se houver dados no FIREPHP para serem mostrados
     // que vieram de um redirecionamento.
     Firephp::throwRedirectLog();
     // Segue ritmo normal do dispatch
     return parent::dispatch($request, $response);
 }
 /** {@inheritdoc} */
 public function dispatch(\Zend\Stdlib\RequestInterface $request, \Zend\Stdlib\ResponseInterface $response = null)
 {
     // Fetch client with given ID for actions referring to a particular client
     $action = $this->getEvent()->getRouteMatch()->getParam('action');
     if ($action != 'index' and $action != 'search' and $action != 'import') {
         try {
             $this->_currentClient = $this->_clientManager->getClient($request->getQuery('id'));
         } catch (\RuntimeException $e) {
             // Client does not exist - may happen when URL has become stale.
             $this->flashMessenger()->addErrorMessage('The requested client does not exist.');
             return $this->redirectToRoute('client', 'index');
         }
     }
     return parent::dispatch($request, $response);
 }
 public function dispatch(\Zend\Stdlib\RequestInterface $request, \Zend\Stdlib\ResponseInterface $response = null)
 {
     $this->getServiceLocator()->get('viewhelpermanager')->get('InlineScript')->appendFile('/js/home-charts.js');
     $this->objectManager = $this->getServiceLocator()->get('Doctrine\\ORM\\EntityManager');
     return parent::dispatch($request, $response);
 }
 /** {@inheritdoc} */
 public function dispatch(\Zend\Stdlib\RequestInterface $request, \Zend\Stdlib\ResponseInterface $response = null)
 {
     // Fetch group with given name for actions referring to a particular group
     $action = $this->getEvent()->getRouteMatch()->getParam('action');
     if ($action != 'index' and $action != 'add') {
         try {
             $this->_currentGroup = $this->_groupManager->getGroup($request->getQuery('name'));
         } catch (\RuntimeException $e) {
             // Group does not exist - may happen when URL has become stale.
             $this->flashMessenger()->addErrorMessage('The requested group does not exist.');
             return $this->redirectToRoute('group', 'index');
         }
     }
     return parent::dispatch($request, $response);
 }
 /** {@inheritdoc} */
 public function dispatch(\Zend\Stdlib\RequestInterface $request, \Zend\Stdlib\ResponseInterface $response = null)
 {
     $this->setActiveMenu('Inventory', 'Network');
     return parent::dispatch($request, $response);
 }