Files
rxthinkcmf-wiki/RXThinkCMF_ThinkPhp8_EleVue/.vitepress/dist/assets/zh_guide_permission.md.bjP9Fqiv.js
T
2026-10-25 18:52:36 +08:00

6 lines
5.5 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{_ as d,o as e,c as a,a2 as r}from"./chunks/framework.B-QBKwc1.js";const m=JSON.parse('{"title":"权限节点配置","description":"权限节点用于控制用户能访问哪些接口。","frontmatter":{},"headers":[],"relativePath":"zh/guide/permission.md","filePath":"zh/guide/permission.md"}'),s={name:"zh/guide/permission.md"};function o(l,t,p,i,h,n){return e(),a("div",null,[...t[0]||(t[0]=[r(`<h1 id="_3-8-权限节点配置" tabindex="-1">3.8 权限节点配置 <a class="header-anchor" href="#_3-8-权限节点配置" aria-label="Permalink to &quot;3.8 权限节点配置&quot;">​</a></h1><div class="tip custom-block"><p class="custom-block-title">概述</p><p>权限节点用于控制用户能访问哪些接口。通过菜单管理界面配置,格式为 <code>sys:{模块名}:{操作}</code>。</p></div><h2 id="Example-模块权限码" tabindex="-1">Example 模块权限码 <a class="header-anchor" href="#Example-模块权限码" aria-label="Permalink to &quot;Example 模块权限码&quot;">​</a></h2><table tabindex="0"><thead><tr><th>权限码</th><th>说明</th><th>对应接口</th></tr></thead><tbody><tr><td><code>sys:example:page</code></td><td>案例演示分页列表</td><td><code>GET /api/example/page</code></td></tr><tr><td><code>sys:example:add</code></td><td>添加案例演示</td><td><code>POST /api/example/add</code></td></tr><tr><td><code>sys:example:update</code></td><td>修改案例演示</td><td><code>PUT /api/example/update</code></td></tr><tr><td><code>sys:example:delete</code></td><td>删除案例演示</td><td><code>DELETE /api/example/delete/:id</code></td></tr><tr><td><code>sys:example:import</code></td><td>导入案例演示</td><td><code>POST /api/example/import</code></td></tr><tr><td><code>sys:example:export</code></td><td>导出案例演示</td><td><code>GET /api/example/export</code></td></tr></tbody></table><h2 id="配置步骤" tabindex="-1">配置步骤 <a class="header-anchor" href="#配置步骤" aria-label="Permalink to &quot;配置步骤&quot;">​</a></h2><h3 id="_1-添加目录节点" tabindex="-1">1. 添加目录节点 <a class="header-anchor" href="#_1-添加目录节点" aria-label="Permalink to &quot;1. 添加目录节点&quot;">​</a></h3><p>在系统菜单管理中添加一级目录:</p><table tabindex="0"><thead><tr><th>字段</th><th>值</th></tr></thead><tbody><tr><td>菜单名称</td><td>工具管理</td></tr><tr><td>菜单类型</td><td>目录(type=0)</td></tr><tr><td>路由地址</td><td>/tool</td></tr><tr><td>排序</td><td>60</td></tr></tbody></table><h3 id="_2-添加菜单节点" tabindex="-1">2. 添加菜单节点 <a class="header-anchor" href="#_2-添加菜单节点" aria-label="Permalink to &quot;2. 添加菜单节点&quot;">​</a></h3><p>在目录下添加二级菜单:</p><table tabindex="0"><thead><tr><th>字段</th><th>值</th></tr></thead><tbody><tr><td>菜单名称</td><td>案例演示</td></tr><tr><td>菜单类型</td><td>菜单(type=1)</td></tr><tr><td>路由地址</td><td>/example</td></tr><tr><td>组件路径</td><td>tool/example/index</td></tr><tr><td>权限标识</td><td>sys:example:page</td></tr><tr><td>排序</td><td>1</td></tr></tbody></table><h3 id="_3-添加按钮权限" tabindex="-1">3. 添加按钮权限 <a class="header-anchor" href="#_3-添加按钮权限" aria-label="Permalink to &quot;3. 添加按钮权限&quot;">​</a></h3><p>在菜单下添加三级按钮权限:</p><table tabindex="0"><thead><tr><th>字段</th><th>值</th><th>权限标识</th></tr></thead><tbody><tr><td>添加案例演示</td><td>type=2</td><td>sys:example:add</td></tr><tr><td>修改案例演示</td><td>type=2</td><td>sys:example:update</td></tr><tr><td>删除案例演示</td><td>type=2</td><td>sys:example:delete</td></tr><tr><td>导入案例演示</td><td>type=2</td><td>sys:example:import</td></tr><tr><td>导出案例演示</td><td>type=2</td><td>sys:example:export</td></tr></tbody></table><h3 id="_4-分配角色权限" tabindex="-1">4. 分配角色权限 <a class="header-anchor" href="#_4-分配角色权限" aria-label="Permalink to &quot;4. 分配角色权限&quot;">​</a></h3><p>在角色管理中,为角色勾选新增的权限节点。</p><h2 id="菜单类型说明" tabindex="-1">菜单类型说明 <a class="header-anchor" href="#菜单类型说明" aria-label="Permalink to &quot;菜单类型说明&quot;">​</a></h2><table tabindex="0"><thead><tr><th>type</th><th>说明</th><th>前端行为</th></tr></thead><tbody><tr><td>0</td><td>目录</td><td>渲染为侧边栏分组</td></tr><tr><td>1</td><td>菜单</td><td>渲染为可点击的菜单项,对应一个页面</td></tr><tr><td>2</td><td>按钮</td><td>不渲染,仅用于权限校验</td></tr></tbody></table><h2 id="权限校验流程" tabindex="-1">权限校验流程 <a class="header-anchor" href="#权限校验流程" aria-label="Permalink to &quot;权限校验流程&quot;">​</a></h2><div class="language-text vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">text</span><pre class="shiki shiki-themes dracula-soft vitesse-light vp-code" tabindex="0"><code><span class="line"><span>1. 用户登录 → 获取用户角色</span></span>
<span class="line"><span>2. 角色关联菜单 → 获取权限节点列表</span></span>
<span class="line"><span>3. 请求接口 → AuthMiddleware 读取 #[Permission] 注解</span></span>
<span class="line"><span>4. 检查权限码是否在用户权限列表中</span></span>
<span class="line"><span>5. 超级管理员(uid=1)跳过校验,直接放行</span></span></code></pre></div>`,20)])])}const b=d(s,[["render",o]]);export{m as __pageData,b as default};