Skip to content

权限管理

获取权限列表

请求

GET /permission/list

参数

参数类型必填说明
menu_typeint权限类型(0菜单,1按钮,2接口)

响应

json
{
  "code": 200,
  "success": true,
  "data": [
    {
      "id": "uuid",
      "menu_type": 0,
      "parent_id": null,
      "name": "System",
      "title": "系统管理",
      "path": "/system",
      "component": "Layout",
      "icon": "",
      "order": 1,
      "children": [
        {
          "id": "uuid",
          "menu_type": 0,
          "parent_id": "uuid",
          "name": "User",
          "title": "用户管理",
          "path": "user",
          "component": "/system/user/index",
          "icon": "",
          "order": 1
        }
      ]
    }
  ]
}

获取权限详情

请求

GET /permission/{permission_id}

响应

json
{
  "code": 200,
  "success": true,
  "data": {
    "id": "uuid",
    "menu_type": 0,
    "parent_id": null,
    "name": "User",
    "title": "用户管理",
    "path": "/system/user",
    "component": "/system/user/index",
    "icon": "",
    "order": 1,
    "isHide": false,
    "keepAlive": true,
    "min_user_type": 3
  }
}

创建权限

请求

POST /permission

参数

参数类型必填说明
menu_typeint权限类型
parent_idstring父权限 ID
namestring权限名称
titlestring显示标题
pathstring路由路径
componentstring组件路径
iconstring图标
orderint排序
isHidebool是否隐藏
keepAlivebool是否缓存
authTitlestring按钮标题
authMarkstring权限标识
api_pathstringAPI 路径
api_methodstring[]HTTP 方法

响应

json
{
  "code": 200,
  "msg": "创建成功",
  "success": true
}

更新权限

请求

PUT /permission/{permission_id}

参数

同创建权限,所有字段可选。

响应

json
{
  "code": 200,
  "msg": "更新成功",
  "success": true
}

删除权限

请求

DELETE /permission/{permission_id}

响应

json
{
  "code": 200,
  "msg": "删除成功",
  "success": true
}

权限类型说明

类型说明
菜单0前端路由菜单
按钮1前端按钮权限
接口2后端 API 权限

数据权限范围

范围说明
全部1可访问所有数据
本部门及下属2可访问本部门及下属部门数据
仅本部门3仅可访问本部门数据
仅本人4仅可访问本人数据

Released under the MIT License.