public function indexAction($msg = null) { if ($msg != null) { $msg = $msg->compile($this->jquery); $this->view->setVar("msg", $msg); } else { $this->view->setVar("msg", ""); } $this->session->__unset("bread"); if (AuthController::isAuth()) { $user = $this->session->get('user'); switch ($user->getIdRole()) { case 1: $this->adminIndex($msg); break; case 2: $this->dvlpIndex($msg); break; case 3: $this->clientIndex($msg); break; case 4: $this->managerIndex($msg); break; } } }
public function afterExecuteRoute() { $this->view->setVar("siteUrl", $this->url->getBaseUri()); if (!Auth::isAuth()) { $this->dispatcher->forward(array("controller" => "Auth", "action" => "signin")); $this->jquery->exec('$(".breadcrumb").hide();$(".menuItem").hide();$(".nomUser").hide()', true); $this->jquery->compile($this->view); } else { //$this->view->disable(); $allow = true; $user = $this->session->get('user'); if (!($this->dispatcher->getControllerName() == "Index" || $this->dispatcher->getControllerName() == "Auth")) { $allow = false; foreach ($user->getRole()->getAcl() as $acl) { if (($acl->getController() == $this->dispatcher->getControllerName() || $acl->getController() == "Default") && $acl->getAction() == $this->dispatcher->getActionName()) { $allow = true; break; } } } if (!$allow) { $this->dispatcher->forward(array("controller" => "Index", "action" => "index", "params" => array(new DisplayedMessage("Vous n'avez pas accès à cette partie de l'application.", "danger")))); return; } $this->breadCrumbsAction(); $this->menuAction(); $this->userAction(); } }
public function initialize() { if (Auth::isAuth()) { $this->dispatcher->forward(array("controller" => "Index", "action" => "index")); } }