更新开发者平台:代理商管理、版本管理、UI优化
This commit is contained in:
@@ -134,6 +134,26 @@ func DeveloperAuth() gin.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// AgentAuth 代理商授权中间件
|
||||
func AgentAuth() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
role, exists := c.Get("role")
|
||||
if !exists {
|
||||
response.Error(c, http.StatusForbidden, "Access denied")
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
|
||||
if role != "agent" && role != "admin" {
|
||||
response.Error(c, http.StatusForbidden, "Agent access required")
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
|
||||
// PackageAuth 套餐授权中间件
|
||||
func PackageAuth() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
|
||||
Reference in New Issue
Block a user