Skip to content

chore: protect organization endpoints with license #14001

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Jul 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use r.Group to override single endpoints
  • Loading branch information
Emyrk committed Jul 25, 2024
commit 59fb67f2cd0221a72b8cb1ac7d3eb0c08eae14e3
9 changes: 0 additions & 9 deletions coderd/coderd.go
Original file line number Diff line number Diff line change
Expand Up @@ -864,13 +864,11 @@ func New(options *Options) *API {
r.Use(
apiKeyMiddleware,
)
api.APISubRoutes.Organizations = r
r.Get("/", api.organizations)
r.Route("/{organization}", func(r chi.Router) {
r.Use(
httpmw.ExtractOrganizationParam(options.Database),
)
api.APISubRoutes.SingleOrganization = r
r.Get("/", api.organization)
r.Post("/templateversions", api.postTemplateVersionsByOrganization)
r.Route("/templates", func(r chi.Router) {
Expand Down Expand Up @@ -1335,13 +1333,6 @@ type API struct {

// APIHandler serves "/api/v2"
APIHandler chi.Router
// APISubRoutes are AGPL sub routers that are saved for enterprise
// to add endpoints to. Chi does not allow conflicting routers to
// exist, so this is the easier way to "merge" routers.
APISubRoutes struct {
Organizations chi.Router
SingleOrganization chi.Router
}
// RootHandler serves "/"
RootHandler chi.Router

Expand Down