diff --git a/pkg/clients/handlers.go b/pkg/clients/handlers.go index 5792a0e97..e5fa247e5 100644 --- a/pkg/clients/handlers.go +++ b/pkg/clients/handlers.go @@ -35,9 +35,9 @@ type PaginationLinksResponse struct { func (a *API) RegisterEndpoints(mux *chi.Mux) { mux.Get("/api/v0/clients", a.ListClients) mux.Post("/api/v0/clients", a.CreateClient) - mux.Get("/api/v0/clients/{id}", a.GetClient) - mux.Put("/api/v0/clients/{id}", a.UpdateClient) - mux.Delete("/api/v0/clients/{id}", a.DeleteClient) + mux.Get("/api/v0/clients/{id:.+}", a.GetClient) + mux.Put("/api/v0/clients/{id:.+}", a.UpdateClient) + mux.Delete("/api/v0/clients/{id:.+}", a.DeleteClient) } func (a *API) RegisterValidation(v validation.ValidationRegistryInterface) { diff --git a/pkg/groups/handlers.go b/pkg/groups/handlers.go index e24be07dd..e605b103b 100644 --- a/pkg/groups/handlers.go +++ b/pkg/groups/handlers.go @@ -62,19 +62,19 @@ type API struct { // RegisterEndpoints hooks up all the endpoints to the server mux passed via the arg func (a *API) RegisterEndpoints(mux *chi.Mux) { mux.Get("/api/v0/groups", a.handleList) - mux.Get("/api/v0/groups/{id}", a.handleDetail) + mux.Get("/api/v0/groups/{id:.+}", a.handleDetail) mux.Post("/api/v0/groups", a.handleCreate) - mux.Patch("/api/v0/groups/{id}", a.handleUpdate) - mux.Delete("/api/v0/groups/{id}", a.handleRemove) - mux.Get("/api/v0/groups/{id}/roles", a.handleListRoles) - mux.Post("/api/v0/groups/{id}/roles", a.handleAssignRoles) - mux.Delete("/api/v0/groups/{id}/roles/{r_id}", a.handleRemoveRole) - mux.Get("/api/v0/groups/{id}/entitlements", a.handleListPermission) - mux.Patch("/api/v0/groups/{id}/entitlements", a.handleAssignPermission) - mux.Delete("/api/v0/groups/{id}/entitlements/{e_id}", a.handleRemovePermission) - mux.Get("/api/v0/groups/{id}/identities", a.handleListIdentities) - mux.Patch("/api/v0/groups/{id}/identities", a.handleAssignIdentities) - mux.Delete("/api/v0/groups/{id}/identities/{i_id}", a.handleRemoveIdentities) + mux.Patch("/api/v0/groups/{id:.+}", a.handleUpdate) + mux.Delete("/api/v0/groups/{id:.+}", a.handleRemove) + mux.Get("/api/v0/groups/{id:.+}/roles", a.handleListRoles) + mux.Post("/api/v0/groups/{id:.+}/roles", a.handleAssignRoles) + mux.Delete("/api/v0/groups/{id:.+}/roles/{r_id:.+}", a.handleRemoveRole) + mux.Get("/api/v0/groups/{id:.+}/entitlements", a.handleListPermission) + mux.Patch("/api/v0/groups/{id:.+}/entitlements", a.handleAssignPermission) + mux.Delete("/api/v0/groups/{id:.+}/entitlements/{e_id:.+}", a.handleRemovePermission) + mux.Get("/api/v0/groups/{id:.+}/identities", a.handleListIdentities) + mux.Patch("/api/v0/groups/{id:.+}/identities", a.handleAssignIdentities) + mux.Delete("/api/v0/groups/{id:.+}/identities/{i_id:.+}", a.handleRemoveIdentities) } func (a *API) RegisterValidation(v validation.ValidationRegistryInterface) { diff --git a/pkg/identities/handlers.go b/pkg/identities/handlers.go index 45dcc7ec3..a6eda46ff 100644 --- a/pkg/identities/handlers.go +++ b/pkg/identities/handlers.go @@ -36,13 +36,13 @@ type API struct { func (a *API) RegisterEndpoints(mux *chi.Mux) { mux.Get("/api/v0/identities", a.handleList) - mux.Get("/api/v0/identities/{id}", a.handleDetail) + mux.Get("/api/v0/identities/{id:.+}", a.handleDetail) mux.Post("/api/v0/identities", a.handleCreate) - mux.Put("/api/v0/identities/{id}", a.handleUpdate) - // mux.Patch("/api/v0/identities/{id}", a.handlePartialUpdate) - mux.Delete("/api/v0/identities/{id}", a.handleRemove) - // mux.Delete("/api/v0/identities/{id}/sessions", a.handleSessionRemove) - // mux.Delete("/api/v0/identities/{id}/credentials/{type}", a.handleCrededntialRemove) + mux.Put("/api/v0/identities/{id:.+}", a.handleUpdate) + // mux.Patch("/api/v0/identities/{id:.+}", a.handlePartialUpdate) + mux.Delete("/api/v0/identities/{id:.+}", a.handleRemove) + // mux.Delete("/api/v0/identities/{id:.+}/sessions", a.handleSessionRemove) + // mux.Delete("/api/v0/identities/{id:.+}/credentials/{type}", a.handleCrededntialRemove) } func (a *API) RegisterValidation(v validation.ValidationRegistryInterface) { diff --git a/pkg/roles/handlers.go b/pkg/roles/handlers.go index 5e0ee3f0d..617b3ef43 100644 --- a/pkg/roles/handlers.go +++ b/pkg/roles/handlers.go @@ -53,14 +53,14 @@ type API struct { // RegisterEndpoints hooks up all the endpoints to the server mux passed via the arg func (a *API) RegisterEndpoints(mux *chi.Mux) { mux.Get("/api/v0/roles", a.handleList) - mux.Get("/api/v0/roles/{id}", a.handleDetail) + mux.Get("/api/v0/roles/{id:.+}", a.handleDetail) mux.Post("/api/v0/roles", a.handleCreate) - mux.Patch("/api/v0/roles/{id}", a.handleUpdate) - mux.Delete("/api/v0/roles/{id}", a.handleRemove) - mux.Get("/api/v0/roles/{id}/entitlements", a.handleListPermission) - mux.Patch("/api/v0/roles/{id}/entitlements", a.handleAssignPermission) // this can only work for assignment unless payload includes add and remove - mux.Delete("/api/v0/roles/{id}/entitlements/{e_id}", a.handleRemovePermission) - mux.Get("/api/v0/roles/{id}/groups", a.handleListRoleGroup) + mux.Patch("/api/v0/roles/{id:.+}", a.handleUpdate) + mux.Delete("/api/v0/roles/{id:.+}", a.handleRemove) + mux.Get("/api/v0/roles/{id:.+}/entitlements", a.handleListPermission) + mux.Patch("/api/v0/roles/{id:.+}/entitlements", a.handleAssignPermission) // this can only work for assignment unless payload includes add and remove + mux.Delete("/api/v0/roles/{id:.+}/entitlements/{e_id:.+}", a.handleRemovePermission) + mux.Get("/api/v0/roles/{id:.+}/groups", a.handleListRoleGroup) } func (a *API) RegisterValidation(v validation.ValidationRegistryInterface) { err := v.RegisterValidatingFunc("roles", a.validatingFunc) diff --git a/pkg/rules/handlers.go b/pkg/rules/handlers.go index b8ec1ac28..a374bf2ac 100644 --- a/pkg/rules/handlers.go +++ b/pkg/rules/handlers.go @@ -28,10 +28,10 @@ type API struct { func (a *API) RegisterEndpoints(mux *chi.Mux) { mux.Get("/api/v0/rules", a.handleList) - mux.Get("/api/v0/rules/{id}", a.handleDetail) + mux.Get("/api/v0/rules/{id:.+}", a.handleDetail) mux.Post("/api/v0/rules", a.handleCreate) - mux.Put("/api/v0/rules/{id}", a.handleUpdate) - mux.Delete("/api/v0/rules/{id}", a.handleRemove) + mux.Put("/api/v0/rules/{id:.+}", a.handleUpdate) + mux.Delete("/api/v0/rules/{id:.+}", a.handleRemove) } func (a *API) RegisterValidation(v validation.ValidationRegistryInterface) {