Skip to content

Commit 7ab9272

Browse files
committed
override individual endpoints
1 parent 9d5f71b commit 7ab9272

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
@@ -181,24 +181,6 @@ func New(ctx context.Context, options *Options) (_ *API, err error) {
181181
return api.refreshEntitlements(ctx)
182182
}
183183

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

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

0 commit comments

Comments
 (0)