/** * 验证权限 view_auth_check * @param null $rule * @return bool */ function view_auth_check($rule = NULL) { /* 管理员允许访问任何页面 */ if (IS_ROOT) { return true; } /* 验证权限 */ $Auth = new \Manager\ORG\Auth(); $rule = substr(strtolower($rule), 1); if ($Auth->check($rule, UID)) { return true; } return false; }
/** * 权限检测 checkRule * @param string $rule 检测的规则 * @param string $mode check模式 * @return boolean */ protected final function checkRule($rule, $type = 1, $mode = 'url') { if (IS_ROOT) { return true; //管理员允许访问任何页面 } static $Auth = NULL; if (!$Auth) { $Auth = new \Manager\ORG\Auth(); } if (!$Auth->check($rule, UID, $type, $mode)) { return false; } return true; }