对RBAC鉴权模型自定义方法修改 完全支持 RESFTUL模式 支持/:params 占位符模式以及 ?query=地址栏参数模式

This commit is contained in:
pixel
2020-03-12 15:04:22 +08:00
parent f9d64d0ffb
commit 65499ccb34
3 changed files with 24 additions and 7 deletions

View File

@@ -40,3 +40,18 @@ func GetPolicyPathByAuthorityId(c *gin.Context) {
paths := new(sysModel.CasbinModel).GetPolicyPathByAuthorityId(cmr.AuthorityId)
servers.ReportFormat(c, true, "获取规则成功", gin.H{"paths": paths})
}
// @Tags casbin
// @Summary casb RBAC RESTFUL测试路由
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body api.CreateAuthorityParams true "获取权限列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /casbin/CasbinTest [get]
func CasbinTest(c *gin.Context) {
// 测试restful以及占位符代码 随意书写
pathParam := c.Param("pathParam")
query := c.Query("query")
servers.ReportFormat(c, true, "获取规则成功", gin.H{"pathParam": pathParam, "query": query})
}