Skip to content

Commit

Permalink
v1.3
Browse files Browse the repository at this point in the history
何全 committed Oct 18, 2019
1 parent 09384e8 commit df4a228
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion middleware/inject/inject.go
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ func init() {
} else if osType == "linux" || osType == "darwin" {
path = "conf/rbac_model.conf"
}
enforcer, _ := casbin.NewEnforcer(path, false)
enforcer, _ := casbin.NewEnforcerSafe(path, false)
_ = g.Provide(&inject.Object{Value: enforcer})

Common := new(bll.Common)
2 changes: 1 addition & 1 deletion middleware/permission/permissions.go
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ func CasbinMiddleware() gin.HandlerFunc {
})
fmt.Println(jwtGet.GetIdFromClaims("username", t.Claims), c.Request.URL.Path, c.Request.Method)

if b, err := inject.Obj.Enforcer.Enforce(jwtGet.GetIdFromClaims("username", t.Claims), c.Request.URL.Path, c.Request.Method); err != nil {
if b, err := inject.Obj.Enforcer.EnforceSafe(jwtGet.GetIdFromClaims("username", t.Claims), c.Request.URL.Path, c.Request.Method); err != nil {

c.JSON(http.StatusUnauthorized, gin.H{
"code": http.StatusOK,

0 comments on commit df4a228

Please sign in to comment.