mirror of
https://github.com/coder/coder.git
synced 2025-07-06 15:41:45 +00:00
* chore: refactor entitlements to keep it in just the options Duplicating the reference did not feel valuable, just confusing
20 lines
467 B
Go
20 lines
467 B
Go
package coderd
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
|
|
"github.com/coder/coder/v2/coderd/httpapi"
|
|
"github.com/coder/coder/v2/codersdk"
|
|
)
|
|
|
|
func (api *API) shouldBlockNonBrowserConnections(rw http.ResponseWriter) bool {
|
|
if api.Entitlements.Enabled(codersdk.FeatureBrowserOnly) {
|
|
httpapi.Write(context.Background(), rw, http.StatusConflict, codersdk.Response{
|
|
Message: "Non-browser connections are disabled for your deployment.",
|
|
})
|
|
return true
|
|
}
|
|
return false
|
|
}
|