/** * Default isAuthorized method * * This is called to see if a user (when logged in) is able to access an action * * @param array $user * @return boolean True if allowed * @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#using-controllerauthorize */ public function isAuthorized($user = null) { return parent::isAuthorized($user); }
/** * Default isAuthorized method * * This is called to see if a user (when logged in) is able to access an action * * @param array $user * @return boolean True if allowed * @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#using-controllerauthorize */ public function isAuthorized($user = null) { $ret = parent::isAuthorized($user); if ($this->action == 'index') { if (!array_key_exists('is_admin', $user)) { $ret = false; } //si es admin general esta autorizado if (empty($user['is_admin'])) { $ret = false; } } return $ret; }