Commit 5e88c69b authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/rbac' into 'master'

rbac See merge request !42
parents 30a013a7 3f48bbf1
......@@ -13,13 +13,6 @@ func AUTH(handlerTableName map[string]string) gin.HandlerFunc {
token := ctx.Request.Header.Get("Token")
user, _ := util.ParseToken(token)
if 81 == user.UserInfo.Uid {
handler.SendResponse(ctx, errno.PermissionDenied, nil)
ctx.Abort()
return
}
if 81 != user.UserInfo.Uid {
ctx.Next()
}
......@@ -29,7 +22,7 @@ func AUTH(handlerTableName map[string]string) gin.HandlerFunc {
ctx.Next()
}
handleAlowed := []string{"GetWallets", "GetWalletCoinRelationCoinRelations", "GetCoins"}
handleAlowed := []string{"GetCoinChains", "GetUserChains"}
_, handle := util.Contains(handleAlowed, handlerName)
if !handle {
......
package routers
import (
"bwallet/middleware/auth"
"bwallet/middleware/jwt"
"bwallet/middleware/log"
"bwallet/pkg/e"
......@@ -44,16 +45,15 @@ func InitRouter() *gin.Engine {
client.GET("/live-charge", app.GetLiveCharge)
client.GET("/live/status", app.LiveStatus)
client.POST("/live/notifyUrl", app.NotifyUrl)
client.POST("/live/verify",app.VerifyStatus)
client.GET("/live-banners",app.GetLiveBanners)
client.POST("/live/verify", app.VerifyStatus)
client.GET("/live-banners", app.GetLiveBanners)
client.GET("/fees/recommended",app.GetTransactionGas)
client.GET("/tokenview/explore",app.Explore)
client.GET("/fees/recommended", app.GetTransactionGas)
client.GET("/tokenview/explore", app.Explore)
api := r.Group("/api")
api.Use(jwt.JWT())
//api.Use(auth.AUTH(e.HandleTableName))
api.Use(jwt.JWT()).Use(auth.AUTH(e.HandleTableName))
api.POST("/log", backend.AddOperationLog)
api.GET("/logs", backend.GetOperationLogs)
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