Skip to content

Commit 3e40ade

Browse files
committed
override individual endpoints
1 parent 59fb67f commit 3e40ade

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

enterprise/coderd/coderd.go

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -183,24 +183,6 @@ func New(ctx context.Context, options *Options) (_ *API, err error) {
183183
return api.refreshEntitlements(ctx)
184184
}
185185

186-
// /organizations route
187-
api.AGPL.APISubRoutes.Organizations.Group(func(r chi.Router) {
188-
r.Use(
189-
api.RequireFeatureMW(codersdk.FeatureMultipleOrganizations),
190-
httpmw.RequireExperiment(api.AGPL.Experiments, codersdk.ExperimentMultiOrganization),
191-
)
192-
r.Post("/", api.postOrganizations)
193-
})
194-
195-
api.AGPL.APISubRoutes.SingleOrganization.Group(func(r chi.Router) {
196-
r.Use(
197-
api.RequireFeatureMW(codersdk.FeatureMultipleOrganizations),
198-
httpmw.RequireExperiment(api.AGPL.Experiments, codersdk.ExperimentMultiOrganization),
199-
)
200-
r.Patch("/", api.patchOrganization)
201-
r.Delete("/", api.deleteOrganization)
202-
})
203-
204186
api.AGPL.APIHandler.Group(func(r chi.Router) {
205187
r.Get("/entitlements", api.serveEntitlements)
206188
// /regions overrides the AGPL /regions endpoint
@@ -259,6 +241,26 @@ func New(ctx context.Context, options *Options) (_ *API, err error) {
259241
})
260242
})
261243

244+
r.Group(func(r chi.Router) {
245+
r.Use(
246+
apiKeyMiddleware,
247+
api.RequireFeatureMW(codersdk.FeatureMultipleOrganizations),
248+
httpmw.RequireExperiment(api.AGPL.Experiments, codersdk.ExperimentMultiOrganization),
249+
)
250+
r.Post("/organizations", api.postOrganizations)
251+
})
252+
253+
r.Group(func(r chi.Router) {
254+
r.Use(
255+
apiKeyMiddleware,
256+
api.RequireFeatureMW(codersdk.FeatureMultipleOrganizations),
257+
httpmw.RequireExperiment(api.AGPL.Experiments, codersdk.ExperimentMultiOrganization),
258+
httpmw.ExtractOrganizationParam(api.Database),
259+
)
260+
r.Patch("/organizations/{organization}", api.patchOrganization)
261+
r.Delete("/organizations/{organization}", api.deleteOrganization)
262+
})
263+
262264
r.Route("/organizations/{organization}/groups", func(r chi.Router) {
263265
r.Use(
264266
apiKeyMiddleware,

0 commit comments

Comments
 (0)