Пример #1
0
 public function onDispatch(MvcEvent $e)
 {
     //Verificamos si no existe una sesion creada
     if (!SessionManager::sessionExist()) {
         $e->getRouteMatch()->setParam('controller', 'Auth\\Controller\\Auth');
         $e->getRouteMatch()->setParam('action', 'login');
     }
 }
Пример #2
0
 public function checkAcl(MvcEvent $e)
 {
     $route = $e->getRouteMatch()->getMatchedRouteName();
     //you set your role
     $userRole = SessionManager::getRol();
     if ($route == 'auth') {
         return;
     }
     if ($e->getViewModel()->acl->isAllowed($userRole, $route)) {
         return;
     } else {
         $response = $e->getResponse();
         //location to page or what ever
         $response->getHeaders()->addHeaderLine('Location', $e->getRequest()->getBaseUrl() . '/404');
         $response->setStatusCode(404);
     }
 }
Пример #3
0
 public function outAction()
 {
     SessionManager::destroy();
     return $this->redirect()->toRoute('auth');
 }