/** * 验证当前访问节点是否有权限 * @param string $module 模块名称 * @param string $node 节点名称 * @return bool ture/false: */ static function checkLogin($module, $node) { // 判断该项目是否需要认证 if (C('USER_AUTH_ON') === false) { return true; } // 判断当前模块是否为不需要认证模块 if (C('NOT_AUTH_NODE') != '') { $notauths = explode(',', C('NOT_AUTH_NODE')); if (in_array($module . '-' . $node, $notauths)) { return true; } } // 认证方式1为登陆认证,2为实时认证 if (C('USER_AUTH_TYPE') === 1) { $accesslists = isset($_SESSION[C('USER_AUTH_KEY')]) ? $_SESSION[C('USER_AUTH_KEY')] : M('InterfacePower')->getUserPower(get_usertoken()); } if (C('USER_AUTH_TYPE') === 2) { $accesslists = M('InterfacePower')->getUserPower(get_usertoken()); } if (isset($accesslists[$module]) && in_array($node, $accesslists[$module])) { return true; } else { return false; } }
/** * 获取鉴权mod和act * @return array * @author yxd */ public function act_getmenutree() { $accesslists = M('InterfacePower')->getUserPower(get_usertoken()); return $accesslists; }