Sfoglia il codice sorgente

Revert "update 完善优化代码的权限验证"

This reverts commit fe785a44e0777dfa9a9cbe13fbb4e4a16387ada2.
Alvin 8 mesi fa
parent
commit
a334b5badc
1 ha cambiato i file con 9 aggiunte e 17 eliminazioni
  1. 9 17
      game/game_cluster/nodes/webadmin/router/middleware.go

+ 9 - 17
game/game_cluster/nodes/webadmin/router/middleware.go

@@ -37,22 +37,14 @@ func Auth(settingObj cfacade.ProfileJSON) gin.HandlerFunc {
 			return
 		}
 
-		if result != constant.AdminAccess {
-			// 获取请求URL
-			url := c.Request.URL.Path
-			s, err := mdb.RDB.HGet(context.Background(), common.GetTokenKey(tokenString), url).Result()
-			if err != nil {
-				mhayaLogger.Warnf("Auth HGet s error: %s", err.Error())
-				common.PackUnauthorizedResult(c, code.InternalError, "")
-				return
-			}
-
-			// 检查是否有权限
-			if s == "" {
-				common.PackUnauthorizedResult(c, code.UnauthorizedError, "token is no auth")
-				return
-			}
-		}
+		// 获取请求URL
+		// url := c.Request.URL.Path
+		// s, err := mdb.RDB.HGet(context.Background(), common.GetTokenKey(tokenString), url).Result()
+		// if err != nil {
+		// 	mhayaLogger.Warnf("Auth HGet s error: %s", err.Error())
+		// 	common.PackUnauthorizedResult(c, code.InternalError, "")
+		// 	return
+		// }
 
 		ss, err := mdb.RDB.HGet(context.Background(), common.GetTokenKey(tokenString), constant.AdminAccess).Result()
 		if err != nil {
@@ -62,7 +54,7 @@ func Auth(settingObj cfacade.ProfileJSON) gin.HandlerFunc {
 		}
 
 		// 检查是否有权限
-		if ss == "" {
+		if ss == "" && result == "" {
 			common.PackUnauthorizedResult(c, code.UnauthorizedError, "token is no auth")
 			return
 		}