优化casbin接口鉴权问题,不再重复查询数据库
This commit is contained in:
1 parent
a06bd289b3
commit
a8d5846483
4 files changed
+24
-4
No files matched your search
@@ -16,8 +16,7 @@ func AuthCheckRole() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
data, _ := c.Get(jwtauth.JwtPayloadKey)
|
||||
v := data.(jwtauth.MapClaims)
|
||||
e, err := mycasbin.Casbin()
|
||||
tools.HasError(err, "", 500)
|
||||
e := mycasbin.Casbin()
|
||||
//检查权限
|
||||
res, err := e.Enforce(v["rolekey"], c.Request.URL.Path, c.Request.Method)
|
||||
tools.HasError(err, "", 500)
|
||||
|
||||
Reference in new issue
Block a user