Commit 3f48bbf1 authored by shajiaiming's avatar shajiaiming

rbac

parent af2edcf0
...@@ -13,13 +13,6 @@ func AUTH(handlerTableName map[string]string) gin.HandlerFunc { ...@@ -13,13 +13,6 @@ func AUTH(handlerTableName map[string]string) gin.HandlerFunc {
token := ctx.Request.Header.Get("Token") token := ctx.Request.Header.Get("Token")
user, _ := util.ParseToken(token) user, _ := util.ParseToken(token)
if 81 == user.UserInfo.Uid {
handler.SendResponse(ctx, errno.PermissionDenied, nil)
ctx.Abort()
return
}
if 81 != user.UserInfo.Uid { if 81 != user.UserInfo.Uid {
ctx.Next() ctx.Next()
} }
...@@ -29,7 +22,7 @@ func AUTH(handlerTableName map[string]string) gin.HandlerFunc { ...@@ -29,7 +22,7 @@ func AUTH(handlerTableName map[string]string) gin.HandlerFunc {
ctx.Next() ctx.Next()
} }
handleAlowed := []string{"GetWallets", "GetWalletCoinRelationCoinRelations", "GetCoins"} handleAlowed := []string{"GetCoinChains", "GetUserChains"}
_, handle := util.Contains(handleAlowed, handlerName) _, handle := util.Contains(handleAlowed, handlerName)
if !handle { if !handle {
......
package routers package routers
import ( import (
"bwallet/middleware/auth"
"bwallet/middleware/jwt" "bwallet/middleware/jwt"
"bwallet/middleware/log" "bwallet/middleware/log"
"bwallet/pkg/e" "bwallet/pkg/e"
...@@ -44,16 +45,15 @@ func InitRouter() *gin.Engine { ...@@ -44,16 +45,15 @@ func InitRouter() *gin.Engine {
client.GET("/live-charge", app.GetLiveCharge) client.GET("/live-charge", app.GetLiveCharge)
client.GET("/live/status", app.LiveStatus) client.GET("/live/status", app.LiveStatus)
client.POST("/live/notifyUrl", app.NotifyUrl) client.POST("/live/notifyUrl", app.NotifyUrl)
client.POST("/live/verify",app.VerifyStatus) client.POST("/live/verify", app.VerifyStatus)
client.GET("/live-banners",app.GetLiveBanners) client.GET("/live-banners", app.GetLiveBanners)
client.GET("/fees/recommended",app.GetTransactionGas) client.GET("/fees/recommended", app.GetTransactionGas)
client.GET("/tokenview/explore",app.Explore) client.GET("/tokenview/explore", app.Explore)
api := r.Group("/api") api := r.Group("/api")
api.Use(jwt.JWT()) api.Use(jwt.JWT()).Use(auth.AUTH(e.HandleTableName))
//api.Use(auth.AUTH(e.HandleTableName))
api.POST("/log", backend.AddOperationLog) api.POST("/log", backend.AddOperationLog)
api.GET("/logs", backend.GetOperationLogs) api.GET("/logs", backend.GetOperationLogs)
api.Use(log.LogMiddleware(e.HandleTableName)) api.Use(log.LogMiddleware(e.HandleTableName))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment