public function isAllowed($privilege) { $id = $this->_session->getSessionId(); if (!is_null($id)) { $user = $this->_userRepo->get($id); if (!is_null($user)) { if ($this->_acl->isAllowed($user->getRole(), $this->_resource, $privilege)) { return true; } else { $this->redirect('home/notprivileged?resource=' . $this->_resource . '&privilege=' . $privilege . '&role=' . $user->getRole()); } } } $this->login(); }
public static function getInstance() { if (self::$_instance === null) { self::$_instance = new self(); } return self::$_instance; }
public function __construct() { $this->openConnection(); $this->_userId = 0; if (0 !== strpos($_SERVER['REQUEST_URI'], '/cron')) { $this->_userId = Application_Service_Session::getInstance()->getSessionId(); } }
public function routeShutdown(Zend_Controller_Request_Abstract $request) { $publicControllers = ['cron', 'index', 'share']; if (false !== array_search($request->getControllerName(), $publicControllers)) { return; } $user = Application_Model_UserRepository::getInstance()->get(Application_Service_Session::getInstance()->getSessionId()); if ($user && 'admin' === $user->getRole()) { return; } $request->setModuleName('default'); $request->setControllerName('maintenance'); $request->setActionName('index'); }