From 2c88c99afe3b6f68d9f74d68f7e02a62e2f2c32d Mon Sep 17 00:00:00 2001 From: colly_wyx <wangyixiong_007@163.com> Date: Fri, 11 Aug 2017 13:56:01 +0800 Subject: [PATCH] 修改默认路口 --- application/core/System/Controller/Admin.php | 34 ++++++++++++++++++++++++++++++++-- 1 files changed, 32 insertions(+), 2 deletions(-) diff --git a/application/core/System/Controller/Admin.php b/application/core/System/Controller/Admin.php index b702b5e..10619e8 100644 --- a/application/core/System/Controller/Admin.php +++ b/application/core/System/Controller/Admin.php @@ -9,6 +9,7 @@ public $layout = APP_ROOT.'/modules/Admin/views/layout/adminLayout.phtml'; public $defaultMsgTemplate = 'common/showmsg.phtml'; public $config = array(); + public $session = array(); /** * @var boolean ������������������������ authenticate */ @@ -24,10 +25,30 @@ public $currentRequest = ''; public function init(){ - $session = Yaf_Session::getInstance(); - if(!$session->has('user')){ + $this->session = Yaf_Session::getInstance(); + if(!$this->session->has('user')){ $this->redirect('/user_login.html'); } + //���������redis + $this->redis = System_Service_Locator::getInstance()->get('redis'); + if(!$this->redis->exists('modules') ){ + $this->redis->set('modules', $this->getModules()); + } + //������������������ + if(!$this->redis->exists('role_auth')){ + Util::updateRoleAuth(); + } + $role_auth = $this->redis->get('role_auth'); + $module_service = new Service_Module(); + // $current_module = $module_service->getModuleInfo(array('module' => strtolower($this->_request->module), 'controller' => strtolower($this->_request->controller), 'action' => strtolower($this->_request->action))); + // if($current_module){ + // if(!in_array($current_module['_id'], $role_auth[$this->session['user']['role_id']])){ + // $this->redirect('/error/show/type/no_auth'); + // } + // } + // else{ + // $this->redirect('/error/show/type/not_found'); + // } parent::init(); // $currentRequest = '/' . strtolower( implode('/', [ /// $this->_request->module, @@ -109,4 +130,13 @@ return json_encode($data, JSON_UNESCAPED_UNICODE); } + /** + * ������������������ + * @return [type] [description] + */ + public function getModules(){ + $this->module_service = new Service_Module(); + return $this->module_service->getModuleList(array(), array(), array('level' => 1)); + } + } \ No newline at end of file -- Gitblit v1.8.0