| 102 | } |
| 103 | |
| 104 | func HeaderNavModuleAuth(module string) gin.HandlerFunc { |
| 105 | return func(c *gin.Context) { |
| 106 | access := getHeaderNavAccess(module) |
| 107 | if !access.Enabled { |
| 108 | c.JSON(http.StatusForbidden, gin.H{ |
| 109 | "success": false, |
| 110 | "message": fmt.Sprintf("%s is disabled", module), |
| 111 | }) |
| 112 | c.Abort() |
| 113 | return |
| 114 | } |
| 115 | |
| 116 | if access.RequireAuth { |
| 117 | UserAuth()(c) |
| 118 | return |
| 119 | } |
| 120 | |
| 121 | TryUserAuth()(c) |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | func HeaderNavModulePublicOrUserAuth(module string) gin.HandlerFunc { |
| 126 | return func(c *gin.Context) { |