diff --git a/api/auth.go b/api/auth.go index 78e540b..1564d11 100644 --- a/api/auth.go +++ b/api/auth.go @@ -93,7 +93,7 @@ func listQueryRole(c *gin.Context) { // @Failure 401 {object} dto.ErrorDto // @Failure 404 {object} dto.ErrorDto // @Failure 500 {object} dto.ErrorDto -// @Router /api/v1/role [post] +// @Router /api/v1/auth/role [post] func createRole(c *gin.Context) { req := dto.AuthRoleReqDto{} if err := c.ShouldBind(&req); err != nil { @@ -118,7 +118,7 @@ func createRole(c *gin.Context) { // @Failure 401 {object} dto.ErrorDto // @Failure 404 {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) { id, exist := c.Params.Get("id") if !exist { @@ -145,7 +145,7 @@ func queryRoleInfo(c *gin.Context) { // @Failure 401 {object} dto.ErrorDto // @Failure 404 {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) { id, exist := c.Params.Get("id") if !exist { @@ -180,7 +180,7 @@ func updateRoleInfo(c *gin.Context) { // @Failure 401 {object} dto.ErrorDto // @Failure 404 {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) { id, exist := c.Params.Get("id") if !exist { diff --git a/docs/docs.go b/docs/docs.go index 67f75ba..98e68c1 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -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": { "get": { "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": { "post": { "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": { "post": { "security": [ diff --git a/docs/swagger.json b/docs/swagger.json index 5543ed8..c2b1c7d 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -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": { "get": { "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": { "post": { "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": { "post": { "security": [ diff --git a/docs/swagger.yaml b/docs/swagger.yaml index da3b1b9..bf02ec5 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -655,6 +655,175 @@ paths: summary: 分页查询接口路径信息 tags: - 权限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: get: consumes: @@ -1907,175 +2076,6 @@ paths: summary: 从发布数据拉取信息到草稿 tags: - 发布的图形数据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: post: consumes: diff --git a/middleware/auth.go b/middleware/auth.go index f759aca..21b3711 100644 --- a/middleware/auth.go +++ b/middleware/auth.go @@ -2,6 +2,7 @@ package middleware import ( "regexp" + "strings" "github.com/gin-gonic/gin" "go.uber.org/zap" @@ -46,7 +47,7 @@ func permissionMiddleware() gin.HandlerFunc { // 验证路径 func validateUserPath(path, method string, paths []*dto.AuthPath) bool { for _, p := range paths { - if p.Method == "*" || p.Method == method { + if p.Method == "*" || strings.Contains(p.Method, method) { // 判断方法是否匹配 if p.Path == path { return true } else {