From c315a791545733391c15e42bc747e34293d36a99 Mon Sep 17 00:00:00 2001
From: colly_wyx <wangyixiong_007@163.com>
Date: Sat, 28 Apr 2018 14:50:19 +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