/** * This pre-dispatch event-hook checks backend permissions * * @param \Enlight_Event_EventArgs $args * @throws Enlight_Controller_Exception * @return void */ public function onPreDispatchBackend(Enlight_Event_EventArgs $args) { $this->action = $args->getSubject(); $this->request = $this->action->Request(); $this->aclResource = strtolower($this->request->getControllerName()); if ($this->request->getModuleName() != 'backend' || in_array($this->aclResource, array('error'))) { return; } if ($this->shouldAuth()) { if ($this->checkAuth() === null) { if ($this->request->isXmlHttpRequest()) { throw new Enlight_Controller_Exception('Unauthorized', 401); } else { $this->action->redirect('backend/'); } } } else { $this->initLocale(); } }