<?php
namespace Admin\Controller;
use Think\Controller;
use Org\Util\Rbac;
Class CommonController extends Controller{
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){
RBAC::AccessDecision() || $this->error('没有权限');
}
}
}
3.2.3无需添加GROUP_NAME,,3.2.3取消了用户多入口,用项目分组来替代,无需添加GROUP_NAME
正确写法如上,RBAC::AccessDecision() || $this->error('没有权限');
错误写法:RBAC::AccessDecision(GROUP_NAME) || $this->error('没有权限'); 所有的节点都没有权限