function _initialize()
 {
     $this->siteid = get_siteid();
     // 用户权限检查
     if (C('USER_AUTH_ON') && !in_array(CONTROLLER_NAME, explode(',', C('NOT_AUTH_MODULE')))) {
         if (!RBAC::AccessDecision()) {
             //检查认证识别号
             if (!$_SESSION[C('USER_AUTH_KEY')]) {
                 //跳转到认证网关
                 //$this->error('请先登录后台管理','index.php/Admin/Public/login/');
                 redirect('index.php/Admin/Public/login/');
             }
             // 没有权限 抛出错误
             if (C('RBAC_ERROR_PAGE')) {
                 // 定义权限错误页面
                 $this->assign('jumpUrl', __MODULE__ . C('RBAC_ERROR_PAGE'));
                 $this->error('您没有权限操作该项');
                 D('Log')->addLog(2);
                 // redirect(C('RBAC_ERROR_PAGE'));
             } else {
                 if (C('GUEST_AUTH_ON')) {
                     $this->assign('jumpUrl', PHP_FILE . C('USER_AUTH_GATEWAY'));
                 }
                 // 提示错误信息
                 $this->error(L('_VALID_ACCESS_'));
             }
         }
     }
     // 记录操作日志
     if (!in_array(ACTION_NAME, array('public_session_life'))) {
         D('Log')->addLog(1);
     }
 }
 protected function check_user_rule()
 {
     if (C('USER_AUTH_ON') && !in_array(MODULE_NAME, explode(',', C('NOT_AUTH_MODULE')))) {
         if (!\Org\Util\Rbac::AccessDecision()) {
             //检查认证识别号
             if (!$_SESSION[C('USER_AUTH_KEY')]) {
                 //跳转到认证网关
                 if (IS_AJAX) {
                     $this->ajaxError('请先登陆');
                 } else {
                     redirect(PHP_FILE . C('USER_AUTH_GATEWAY'));
                 }
             } else {
                 // 没有权限 抛出错误
                 if (C('RBAC_ERROR_PAGE')) {
                     // 定义权限错误页面
                     if (IS_AJAX) {
                         $this->ajaxError('您没有权限');
                     } else {
                         redirect(C('RBAC_ERROR_PAGE'));
                     }
                 } else {
                     $this->error('您没有权限');
                 }
             }
         }
     }
 }
 public function _initialize()
 {
     // 用户权限检查
     if (C('USER_AUTH_ON') && !in_array(MODULE_NAME, explode(',', C('NOT_AUTH_MODULE')))) {
         if (!Rbac::AccessDecision()) {
             //检查认证识别号
             if (!$_SESSION[C('USER_AUTH_KEY')]) {
                 if (IS_AJAX) {
                     $this->ajaxReturn(true, "", 301);
                 } else {
                     //跳转到认证网关
                     redirect(C('USER_AUTH_GATEWAY'));
                 }
             }
             // 没有权限 抛出错误
             if (C('RBAC_ERROR_PAGE')) {
                 // 定义权限错误页面
                 redirect(C('RBAC_ERROR_PAGE'));
             } else {
                 if (C('GUEST_AUTH_ON')) {
                     $this->assign('jumpUrl', C('USER_AUTH_GATEWAY'));
                 }
                 // 提示错误信息
                 $this->error(L('_VALID_ACCESS_'));
             }
         }
     }
 }
Exemplo n.º 4
0
 public function _initialize()
 {
     $access = \Org\Util\Rbac::AccessDecision();
     if (!$access) {
         $this->error('你没有权限');
     }
 }
Exemplo n.º 5
0
{
    public function index()
    {
        $this->redirect(CONTROLLER_NAME . '_index');
    }
    public function _initialize()
    {
        if (!isset($_SESSION[C('USER_AUTH_KEY')])) {
            $this->redirect('Admin/Index/index');
Exemplo n.º 6
0
{
    public function index()
    {
        $this->redirect(CONTROLLER_NAME . '_index');
    }
    public function _initialize()
    {
        if (!isset($_SESSION[C('USER_AUTH_KEY')])) {
            $this->redirect('Material/Index/index');
Exemplo n.º 7
0
 protected function _initialize()
 {
     if (!Rbac::AccessDecision()) {
         // 未通过认证
         // 登录检查
         Rbac::checkLogin();
         // 提示错误信息 无权限
         $this->error(L('_VALID_ACCESS_'));
         //echo("没有权限");
     }
 }
Exemplo n.º 8
0
 public function _initialize()
 {
     if (!isset($_SESSION[C('USER_AUTH_KEY')])) {
         $this->redirect('Admin/Login/index');
     }
     /* 不需要验证权限的方法处理 */
     $notAuth = in_array(MODULE_NAME, explode(',', C('NOT_AUTH_MODULE'))) || in_array(ACTION_NAME, explode(',', C('NOT_AUTH_ACTION')));
     if (C('USER_AUTH_ON') && !$notAuth) {
         import('ORG.Util.RBAC');
         Rbac::AccessDecision() || $this->error('没有权限');
     }
 }
 public function _initialize()
 {
     if (!isset($_SESSION[C('USER_AUTH_KEY')])) {
         $this->redirect('Home/Login/index');
     }
     $notAuth = in_array(MODULE_NAME, explode(',', C('NOT_AUTH_MODULE'))) || in_array(ACTION_NAME, explode(',', C('NOT_AUTH_ACTION')));
     //p($_SESSION);//die;
     if (C('USER_AUTH_ON') && !$notAuth) {
         import('Org.Util.Rbac.class.php');
         //$rbac ='' ;
         \Org\Util\Rbac::AccessDecision() || $this->error('您没用权限访问此版块');
     }
 }
Exemplo n.º 10
0
 protected function _checkLogin()
 {
     if (!session(C('USER_AUTH_KEY')) || !session('username')) {
         if (CONTROLLER_NAME != 'Login') {
             $this->redirect(MODULE_NAME . '/Login/index');
         }
     } else {
         if (CONTROLLER_NAME == 'Login' && ACTION_NAME != 'logout') {
             $this->redirect(MODULE_NAME . '/Index/index');
         }
     }
     if (C('USER_AUTH_ON')) {
         if (!Rbac::AccessDecision()) {
             $this->error('没有权限');
         }
     }
 }
Exemplo n.º 11
0
 /**
  * 权限过滤
  * @return
  */
 protected function filterAccess()
 {
     if (!C('USER_AUTH_ON')) {
         return;
     }
     if (\Org\Util\Rbac::AccessDecision(C('GROUP_AUTH_NAME'))) {
         return;
     }
     if (!$_SESSION[C('USER_AUTH_KEY')]) {
         // 登录认证号不存在
         return $this->redirect(C('USER_AUTH_GATEWAY'));
     }
     if ('Public' === CONTROLLER_NAME && 'Public' === ACTION_NAME) {
         // 首页无法进入,则登出帐号
         D('Admin', 'Service')->logout();
     }
     return $this->error('您没有权限执行该操作!');
 }
Exemplo n.º 12
0
 public function _initialize()
 {
     $auto_login = new \User\Api\UserApi();
     if ($auto_login->AutoLogin()) {
         // session _ACCESS_LIST
         // print_r($_SESSION);
         if (session('user_role') == 3 || session('user_role') == 4) {
             $this->redirect('/User/Page/intro');
             return;
         }
         $access = \Org\Util\Rbac::AccessDecision();
         if (!$access) {
             $this->error('对不起,您没有访问权限');
         }
     } else {
         $this->redirect('/User/Page/intro');
     }
 }
Exemplo n.º 13
0
 protected function filterAuth()
 {
     // 用户权限检查
     if (!RBAC::AccessDecision()) {
         // 没有权限 抛出错误
         if (C('RBAC_ERROR_PAGE')) {
             // 定义权限错误页面
             $this->assign('jumpUrl', __MODULE__ . C('RBAC_ERROR_PAGE'));
             $this->error('您没有权限操作该项');
             model('Log')->addLog(2);
             // redirect(C('RBAC_ERROR_PAGE'));
         } else {
             if (C('GUEST_AUTH_ON')) {
                 $this->assign('jumpUrl', PHP_FILE . C('USER_AUTH_GATEWAY'));
             }
             // 提示错误信息
             $this->error(L('_VALID_ACCESS_'));
         }
     }
     // 记录操作日志
     model('Log')->addLog(1);
 }
Exemplo n.º 14
0
 protected function filterAuth()
 {
     // 用户权限检查
     if (!RBAC::AccessDecision()) {
         // 没有权限 抛出错误
         if (C('RBAC_ERROR_PAGE')) {
             // 定义权限错误页面
             $this->assign('jumpUrl', __MODULE__ . C('RBAC_ERROR_PAGE'));
             //$data['auth']=false;
             //$this->error($data,ajax);
             //$this->ajaxReturn($data,'JSON');
             //model('Log')->addLog(2);
             redirect(C('RBAC_ERROR_PAGE'));
         } else {
             if (C('GUEST_AUTH_ON')) {
                 $this->assign('jumpUrl', PHP_FILE . C('USER_AUTH_GATEWAY'));
             }
             // 提示错误信息
             $this->error(L('_VALID_ACCESS_'));
         }
     }
     // 记录操作日志
     //model('Log')->addLog(1);
 }
Exemplo n.º 15
0
 public function _initialize()
 {
     // 用户权限检查
     if (C('USER_AUTH_ON') && !in_array(CONTROLLER_NAME, explode(',', C('NOT_AUTH_MODULE')))) {
         if (!$_SESSION[C('USER_AUTH_KEY')]) {
             // 跳转到认证网关
             if (C('IS_MAIN_COPY')) {
                 redirect(C('MAIN_SITEURL') . C('USER_AUTH_GATEWAY'));
             } else {
                 redirect(PHP_FILE . C('USER_AUTH_GATEWAY'));
             }
         } else {
             if (!\Org\Util\Rbac::AccessDecision()) {
                 // 没有权限 抛出错误
                 if (C('RBAC_ERROR_PAGE')) {
                     // 定义权限错误页面
                     redirect(C('RBAC_ERROR_PAGE'));
                 } else {
                     if (C('GUEST_AUTH_ON')) {
                         $this->assign('jumpUrl', PHP_FILE . C('USER_AUTH_GATEWAY'));
                     }
                     // 提示错误信息
                     $this->error(L('_VALID_ACCESS_'));
                 }
             }
         }
     }
     //获取菜单信息
     $this->menu();
 }