权限检查修改返回结构名称,修复前端无限循环getinfo接口bug

This commit is contained in:
zhangwenjian committed 2020-04-22 23:16:20 +08:00
1 parent 02f46de17c
commit bf494c2131
1 file changed
+4 -4
+4 -4
View File
@@ -16,19 +16,19 @@ func AuthCheckRole() gin.HandlerFunc {
data, _ := c.Get("JWT_PAYLOAD")
v := data.(jwtauth.MapClaims)
e, err := mycasbin.Casbin()
tools.HasError(err,"",500)
tools.HasError(err, "", 500)
//检查权限
res, err := e.Enforce(v["rolekey"], c.Request.URL.Path, c.Request.Method)
log.Println("----------------", v["rolekey"], c.Request.URL.Path, c.Request.Method)
tools.HasError(err,"",500)
tools.HasError(err, "", 500)
if res {
c.Next()
} else {
c.JSON(http.StatusOK, gin.H{
"status": 401,
"msg": "对不起,您没有该接口访问权限,请联系管理员",
"code": 401,
"msg": "对不起,您没有该接口访问权限,请联系管理员",
})
c.Abort()
return