| 17 | const TimeFormatHHMM = "15:04" |
| 18 | |
| 19 | func (api *API) autostopRequirementEnabledMW(next http.Handler) http.Handler { |
| 20 | return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { |
| 21 | feature, ok := api.Entitlements.Feature(codersdk.FeatureAdvancedTemplateScheduling) |
| 22 | if !ok || !feature.Entitlement.Entitled() { |
| 23 | httpapi.Write(r.Context(), rw, http.StatusForbidden, codersdk.Response{ |
| 24 | Message: "Advanced template scheduling (and user quiet hours schedule) is an Enterprise feature. Contact sales!", |
| 25 | }) |
| 26 | return |
| 27 | } |
| 28 | if !feature.Enabled { |
| 29 | httpapi.Write(r.Context(), rw, http.StatusForbidden, codersdk.Response{ |
| 30 | Message: "Advanced template scheduling (and user quiet hours schedule) is not enabled.", |
| 31 | }) |
| 32 | return |
| 33 | } |
| 34 | |
| 35 | next.ServeHTTP(rw, r) |
| 36 | }) |
| 37 | } |
| 38 | |
| 39 | // @Summary Get user quiet hours schedule |
| 40 | // @ID get-user-quiet-hours-schedule |