【权限判断】

This commit is contained in:
weizhihong 2023-08-31 11:07:22 +08:00
parent a6f3a49d4d
commit a857a91753
5 changed files with 705 additions and 704 deletions

View File

@ -93,7 +93,7 @@ func listQueryRole(c *gin.Context) {
// @Failure 401 {object} dto.ErrorDto // @Failure 401 {object} dto.ErrorDto
// @Failure 404 {object} dto.ErrorDto // @Failure 404 {object} dto.ErrorDto
// @Failure 500 {object} dto.ErrorDto // @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/role [post] // @Router /api/v1/auth/role [post]
func createRole(c *gin.Context) { func createRole(c *gin.Context) {
req := dto.AuthRoleReqDto{} req := dto.AuthRoleReqDto{}
if err := c.ShouldBind(&req); err != nil { if err := c.ShouldBind(&req); err != nil {
@ -118,7 +118,7 @@ func createRole(c *gin.Context) {
// @Failure 401 {object} dto.ErrorDto // @Failure 401 {object} dto.ErrorDto
// @Failure 404 {object} dto.ErrorDto // @Failure 404 {object} dto.ErrorDto
// @Failure 500 {object} dto.ErrorDto // @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/role/{id} [get] // @Router /api/v1/auth/role/{id} [get]
func queryRoleInfo(c *gin.Context) { func queryRoleInfo(c *gin.Context) {
id, exist := c.Params.Get("id") id, exist := c.Params.Get("id")
if !exist { if !exist {
@ -145,7 +145,7 @@ func queryRoleInfo(c *gin.Context) {
// @Failure 401 {object} dto.ErrorDto // @Failure 401 {object} dto.ErrorDto
// @Failure 404 {object} dto.ErrorDto // @Failure 404 {object} dto.ErrorDto
// @Failure 500 {object} dto.ErrorDto // @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/role/{id} [put] // @Router /api/v1/auth/role/{id} [put]
func updateRoleInfo(c *gin.Context) { func updateRoleInfo(c *gin.Context) {
id, exist := c.Params.Get("id") id, exist := c.Params.Get("id")
if !exist { if !exist {
@ -180,7 +180,7 @@ func updateRoleInfo(c *gin.Context) {
// @Failure 401 {object} dto.ErrorDto // @Failure 401 {object} dto.ErrorDto
// @Failure 404 {object} dto.ErrorDto // @Failure 404 {object} dto.ErrorDto
// @Failure 500 {object} dto.ErrorDto // @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/role/{id} [delete] // @Router /api/v1/auth/role/{id} [delete]
func deleteRoleInfo(c *gin.Context) { func deleteRoleInfo(c *gin.Context) {
id, exist := c.Params.Get("id") id, exist := c.Params.Get("id")
if !exist { if !exist {

View File

@ -380,6 +380,82 @@ const docTemplate = `{
} }
} }
}, },
"/api/v1/auth/role": {
"post": {
"security": [
{
"JwtAuth": []
}
],
"description": "创建角色",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"权限Api"
],
"summary": "创建角色",
"parameters": [
{
"type": "array",
"items": {
"type": "integer"
},
"collectionFormat": "csv",
"name": "addPaths",
"in": "query"
},
{
"type": "array",
"items": {
"type": "integer"
},
"collectionFormat": "csv",
"name": "delPaths",
"in": "query"
},
{
"type": "integer",
"name": "id",
"in": "query"
},
{
"type": "string",
"name": "name",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "boolean"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/auth/role/list": { "/api/v1/auth/role/list": {
"get": { "get": {
"security": [ "security": [
@ -490,6 +566,195 @@ const docTemplate = `{
} }
} }
}, },
"/api/v1/auth/role/{id}": {
"get": {
"security": [
{
"JwtAuth": []
}
],
"description": "查询角色详情",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"权限Api"
],
"summary": "查询角色详情",
"parameters": [
{
"type": "integer",
"description": "角色ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.AuthRoleDetailRspDto"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
},
"put": {
"security": [
{
"JwtAuth": []
}
],
"description": "修改角色信息",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"权限Api"
],
"summary": "修改角色信息",
"parameters": [
{
"type": "integer",
"description": "角色信息ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "array",
"items": {
"type": "integer"
},
"collectionFormat": "csv",
"name": "addPaths",
"in": "query"
},
{
"type": "array",
"items": {
"type": "integer"
},
"collectionFormat": "csv",
"name": "delPaths",
"in": "query"
},
{
"type": "integer",
"name": "id",
"in": "query"
},
{
"type": "string",
"name": "name",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "boolean"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
},
"delete": {
"security": [
{
"JwtAuth": []
}
],
"description": "删除角色信息",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"权限Api"
],
"summary": "删除角色信息",
"parameters": [
{
"type": "integer",
"description": "角色ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "boolean"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/auth/userLinkRole": { "/api/v1/auth/userLinkRole": {
"post": { "post": {
"security": [ "security": [
@ -2347,271 +2612,6 @@ const docTemplate = `{
} }
} }
}, },
"/api/v1/role": {
"post": {
"security": [
{
"JwtAuth": []
}
],
"description": "创建角色",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"权限Api"
],
"summary": "创建角色",
"parameters": [
{
"type": "array",
"items": {
"type": "integer"
},
"collectionFormat": "csv",
"name": "addPaths",
"in": "query"
},
{
"type": "array",
"items": {
"type": "integer"
},
"collectionFormat": "csv",
"name": "delPaths",
"in": "query"
},
{
"type": "integer",
"name": "id",
"in": "query"
},
{
"type": "string",
"name": "name",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "boolean"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/role/{id}": {
"get": {
"security": [
{
"JwtAuth": []
}
],
"description": "查询角色详情",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"权限Api"
],
"summary": "查询角色详情",
"parameters": [
{
"type": "integer",
"description": "角色ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.AuthRoleDetailRspDto"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
},
"put": {
"security": [
{
"JwtAuth": []
}
],
"description": "修改角色信息",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"权限Api"
],
"summary": "修改角色信息",
"parameters": [
{
"type": "integer",
"description": "角色信息ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "array",
"items": {
"type": "integer"
},
"collectionFormat": "csv",
"name": "addPaths",
"in": "query"
},
{
"type": "array",
"items": {
"type": "integer"
},
"collectionFormat": "csv",
"name": "delPaths",
"in": "query"
},
{
"type": "integer",
"name": "id",
"in": "query"
},
{
"type": "string",
"name": "name",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "boolean"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
},
"delete": {
"security": [
{
"JwtAuth": []
}
],
"description": "删除角色信息",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"权限Api"
],
"summary": "删除角色信息",
"parameters": [
{
"type": "integer",
"description": "角色ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "boolean"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/check/data": { "/api/v1/simulation/check/data": {
"post": { "post": {
"security": [ "security": [

View File

@ -373,6 +373,82 @@
} }
} }
}, },
"/api/v1/auth/role": {
"post": {
"security": [
{
"JwtAuth": []
}
],
"description": "创建角色",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"权限Api"
],
"summary": "创建角色",
"parameters": [
{
"type": "array",
"items": {
"type": "integer"
},
"collectionFormat": "csv",
"name": "addPaths",
"in": "query"
},
{
"type": "array",
"items": {
"type": "integer"
},
"collectionFormat": "csv",
"name": "delPaths",
"in": "query"
},
{
"type": "integer",
"name": "id",
"in": "query"
},
{
"type": "string",
"name": "name",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "boolean"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/auth/role/list": { "/api/v1/auth/role/list": {
"get": { "get": {
"security": [ "security": [
@ -483,6 +559,195 @@
} }
} }
}, },
"/api/v1/auth/role/{id}": {
"get": {
"security": [
{
"JwtAuth": []
}
],
"description": "查询角色详情",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"权限Api"
],
"summary": "查询角色详情",
"parameters": [
{
"type": "integer",
"description": "角色ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.AuthRoleDetailRspDto"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
},
"put": {
"security": [
{
"JwtAuth": []
}
],
"description": "修改角色信息",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"权限Api"
],
"summary": "修改角色信息",
"parameters": [
{
"type": "integer",
"description": "角色信息ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "array",
"items": {
"type": "integer"
},
"collectionFormat": "csv",
"name": "addPaths",
"in": "query"
},
{
"type": "array",
"items": {
"type": "integer"
},
"collectionFormat": "csv",
"name": "delPaths",
"in": "query"
},
{
"type": "integer",
"name": "id",
"in": "query"
},
{
"type": "string",
"name": "name",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "boolean"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
},
"delete": {
"security": [
{
"JwtAuth": []
}
],
"description": "删除角色信息",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"权限Api"
],
"summary": "删除角色信息",
"parameters": [
{
"type": "integer",
"description": "角色ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "boolean"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/auth/userLinkRole": { "/api/v1/auth/userLinkRole": {
"post": { "post": {
"security": [ "security": [
@ -2340,271 +2605,6 @@
} }
} }
}, },
"/api/v1/role": {
"post": {
"security": [
{
"JwtAuth": []
}
],
"description": "创建角色",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"权限Api"
],
"summary": "创建角色",
"parameters": [
{
"type": "array",
"items": {
"type": "integer"
},
"collectionFormat": "csv",
"name": "addPaths",
"in": "query"
},
{
"type": "array",
"items": {
"type": "integer"
},
"collectionFormat": "csv",
"name": "delPaths",
"in": "query"
},
{
"type": "integer",
"name": "id",
"in": "query"
},
{
"type": "string",
"name": "name",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "boolean"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/role/{id}": {
"get": {
"security": [
{
"JwtAuth": []
}
],
"description": "查询角色详情",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"权限Api"
],
"summary": "查询角色详情",
"parameters": [
{
"type": "integer",
"description": "角色ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.AuthRoleDetailRspDto"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
},
"put": {
"security": [
{
"JwtAuth": []
}
],
"description": "修改角色信息",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"权限Api"
],
"summary": "修改角色信息",
"parameters": [
{
"type": "integer",
"description": "角色信息ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "array",
"items": {
"type": "integer"
},
"collectionFormat": "csv",
"name": "addPaths",
"in": "query"
},
{
"type": "array",
"items": {
"type": "integer"
},
"collectionFormat": "csv",
"name": "delPaths",
"in": "query"
},
{
"type": "integer",
"name": "id",
"in": "query"
},
{
"type": "string",
"name": "name",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "boolean"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
},
"delete": {
"security": [
{
"JwtAuth": []
}
],
"description": "删除角色信息",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"权限Api"
],
"summary": "删除角色信息",
"parameters": [
{
"type": "integer",
"description": "角色ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "boolean"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/check/data": { "/api/v1/simulation/check/data": {
"post": { "post": {
"security": [ "security": [

View File

@ -655,6 +655,175 @@ paths:
summary: 分页查询接口路径信息 summary: 分页查询接口路径信息
tags: tags:
- 权限Api - 权限Api
/api/v1/auth/role:
post:
consumes:
- application/json
description: 创建角色
parameters:
- collectionFormat: csv
in: query
items:
type: integer
name: addPaths
type: array
- collectionFormat: csv
in: query
items:
type: integer
name: delPaths
type: array
- in: query
name: id
type: integer
- in: query
name: name
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
type: boolean
"401":
description: Unauthorized
schema:
$ref: '#/definitions/dto.ErrorDto'
"404":
description: Not Found
schema:
$ref: '#/definitions/dto.ErrorDto'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: 创建角色
tags:
- 权限Api
/api/v1/auth/role/{id}:
delete:
consumes:
- application/json
description: 删除角色信息
parameters:
- description: 角色ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
type: boolean
"401":
description: Unauthorized
schema:
$ref: '#/definitions/dto.ErrorDto'
"404":
description: Not Found
schema:
$ref: '#/definitions/dto.ErrorDto'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: 删除角色信息
tags:
- 权限Api
get:
consumes:
- application/json
description: 查询角色详情
parameters:
- description: 角色ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.AuthRoleDetailRspDto'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/dto.ErrorDto'
"404":
description: Not Found
schema:
$ref: '#/definitions/dto.ErrorDto'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: 查询角色详情
tags:
- 权限Api
put:
consumes:
- application/json
description: 修改角色信息
parameters:
- description: 角色信息ID
in: path
name: id
required: true
type: integer
- collectionFormat: csv
in: query
items:
type: integer
name: addPaths
type: array
- collectionFormat: csv
in: query
items:
type: integer
name: delPaths
type: array
- in: query
name: id
type: integer
- in: query
name: name
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
type: boolean
"401":
description: Unauthorized
schema:
$ref: '#/definitions/dto.ErrorDto'
"404":
description: Not Found
schema:
$ref: '#/definitions/dto.ErrorDto'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: 修改角色信息
tags:
- 权限Api
/api/v1/auth/role/list: /api/v1/auth/role/list:
get: get:
consumes: consumes:
@ -1907,175 +2076,6 @@ paths:
summary: 从发布数据拉取信息到草稿 summary: 从发布数据拉取信息到草稿
tags: tags:
- 发布的图形数据Api - 发布的图形数据Api
/api/v1/role:
post:
consumes:
- application/json
description: 创建角色
parameters:
- collectionFormat: csv
in: query
items:
type: integer
name: addPaths
type: array
- collectionFormat: csv
in: query
items:
type: integer
name: delPaths
type: array
- in: query
name: id
type: integer
- in: query
name: name
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
type: boolean
"401":
description: Unauthorized
schema:
$ref: '#/definitions/dto.ErrorDto'
"404":
description: Not Found
schema:
$ref: '#/definitions/dto.ErrorDto'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: 创建角色
tags:
- 权限Api
/api/v1/role/{id}:
delete:
consumes:
- application/json
description: 删除角色信息
parameters:
- description: 角色ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
type: boolean
"401":
description: Unauthorized
schema:
$ref: '#/definitions/dto.ErrorDto'
"404":
description: Not Found
schema:
$ref: '#/definitions/dto.ErrorDto'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: 删除角色信息
tags:
- 权限Api
get:
consumes:
- application/json
description: 查询角色详情
parameters:
- description: 角色ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.AuthRoleDetailRspDto'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/dto.ErrorDto'
"404":
description: Not Found
schema:
$ref: '#/definitions/dto.ErrorDto'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: 查询角色详情
tags:
- 权限Api
put:
consumes:
- application/json
description: 修改角色信息
parameters:
- description: 角色信息ID
in: path
name: id
required: true
type: integer
- collectionFormat: csv
in: query
items:
type: integer
name: addPaths
type: array
- collectionFormat: csv
in: query
items:
type: integer
name: delPaths
type: array
- in: query
name: id
type: integer
- in: query
name: name
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
type: boolean
"401":
description: Unauthorized
schema:
$ref: '#/definitions/dto.ErrorDto'
"404":
description: Not Found
schema:
$ref: '#/definitions/dto.ErrorDto'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: 修改角色信息
tags:
- 权限Api
/api/v1/simulation/check/data: /api/v1/simulation/check/data:
post: post:
consumes: consumes:

View File

@ -2,6 +2,7 @@ package middleware
import ( import (
"regexp" "regexp"
"strings"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"go.uber.org/zap" "go.uber.org/zap"
@ -46,7 +47,7 @@ func permissionMiddleware() gin.HandlerFunc {
// 验证路径 // 验证路径
func validateUserPath(path, method string, paths []*dto.AuthPath) bool { func validateUserPath(path, method string, paths []*dto.AuthPath) bool {
for _, p := range paths { for _, p := range paths {
if p.Method == "*" || p.Method == method { if p.Method == "*" || strings.Contains(p.Method, method) { // 判断方法是否匹配
if p.Path == path { if p.Path == path {
return true return true
} else { } else {