Files
coder/enterprise/coderd/workspaceagents.go
Kyle Carberry 915bb41ea2 feat: Add trial property to licenses (#4372)
* feat: Add trial property to licenses

This allows the frontend to display whether the user is on
a trial license of Coder. This is useful for advertising
Enterprise functionality.

* Improve tests for license enablement code

* Add all features property
2022-10-06 19:28:22 -05:00

23 lines
554 B
Go

package coderd
import (
"context"
"net/http"
"github.com/coder/coder/coderd/httpapi"
"github.com/coder/coder/codersdk"
)
func (api *API) shouldBlockNonBrowserConnections(rw http.ResponseWriter) bool {
api.entitlementsMu.Lock()
browserOnly := api.entitlements.Features[codersdk.FeatureBrowserOnly].Enabled
api.entitlementsMu.Unlock()
if browserOnly {
httpapi.Write(context.Background(), rw, http.StatusConflict, codersdk.Response{
Message: "Non-browser connections are disabled for your deployment.",
})
return true
}
return false
}