MCPcopy Index your code
hub / github.com/coder/coder / autostopRequirementEnabledMW

Method autostopRequirementEnabledMW

enterprise/coderd/users.go:19–37  ·  view source on GitHub ↗
(next http.Handler)

Source from the content-addressed store, hash-verified

17const TimeFormatHHMM = "15:04"
18
19func (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

Callers

nothing calls this directly

Calls 5

WriteFunction · 0.92
EntitledMethod · 0.80
ContextMethod · 0.65
FeatureMethod · 0.45
ServeHTTPMethod · 0.45

Tested by

no test coverage detected