Skip to content

Commit d6225da

Browse files
committed
override individual endpoints
1 parent 47930e8 commit d6225da

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

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

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

0 commit comments

Comments
 (0)