namespace Admin\Controller;
use Think\Controller;
use ORG\Util\RBAC;
class CommonController extends Controller{
function _initialize() {
import('@.ORG.Util.Cookie');
// 用户权限检查
if (C ( 'USER_AUTH_ON' ) && !in_array(MODULE_NAME,explode(',',C('NOT_AUTH_MODULE')))) {
import('@.ORG.Util.RBAC');
if (! RBAC::AccessDecision ()) {
//检查认证识别号
if (! $_SESSION [C ( 'USER_AUTH_KEY' )]) {
if ($this->isAjax()){ // zhanghuihua@msn.com
$this->ajaxReturn(true, "", 301);
} else {
//跳转到认证网关
redirect ( PHP_FILE . C ( 'USER_AUTH_GATEWAY' ) );
}
}
// 没有权限 抛出错误
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_' ) );
}
}
}
}if (! RBAC::AccessDecision ()) 这里报错:Class 'Admin\Controller\RBAC' not found
最佳答案