refactor(api-keys): remove API key reset endpoint and update documentation
Eliminate the POST /tenants/{id}/api-key endpoint for resetting tenant API keys, transitioning to a more granular API key management approach. Update related documentation and API specifications to reflect the new structure, including changes to the tenant API key management paths. Adjust frontend code and internationalization files to remove references to the deprecated API key reset functionality, enhancing clarity and consistency across the application.
This commit is contained in:
@@ -426,7 +426,7 @@ func (g *rbacGuards) CrossTenant() gin.HandlerFunc {
|
||||
// PathTenantMatch enforces that the URL :id matches the caller's
|
||||
// active tenant context (cross-tenant superusers bypass). Routes apply
|
||||
// it at the /tenants/:id group level so every per-tenant endpoint —
|
||||
// GetTenant / UpdateTenant / DeleteTenant / ResetAPIKey / member
|
||||
// GetTenant / UpdateTenant / DeleteTenant / member
|
||||
// management / leave — shares the same check. Replaces the
|
||||
// authorizeTenantAccess helper that used to live inside the tenant
|
||||
// handler.
|
||||
|
||||
@@ -527,7 +527,7 @@ func RegisterChatRoutes(r *gin.RouterGroup, handler *session.Handler, g *rbacGua
|
||||
// - GET /:id Viewer+ (read tenant settings)
|
||||
// - PUT /:id Owner+ (mutate tenant config)
|
||||
// - DELETE /:id Owner+ (also normally a CanAccessAllTenants op)
|
||||
// - POST /:id/api-key Owner+ (rotating the tenant API key is sensitive)
|
||||
// - GET/POST/DELETE /:id/api-keys Owner+ (scoped API key management)
|
||||
// - GET /:id/members Viewer+ (any member can see who else is in)
|
||||
// - POST /:id/members Owner+ (only Owner can add new members)
|
||||
// - PUT /:id/members/:user_id Owner+ (only Owner can change roles)
|
||||
@@ -596,7 +596,6 @@ func RegisterTenantRoutes(
|
||||
tenantByID.GET("", g.Viewer(), handler.GetTenant)
|
||||
tenantByID.PUT("", g.Owner(), handler.UpdateTenant)
|
||||
tenantByID.DELETE("", g.Owner(), handler.DeleteTenant)
|
||||
tenantByID.POST("/api-key", g.Owner(), handler.ResetAPIKey)
|
||||
tenantByID.GET("/api-keys", g.Owner(), handler.ListAPIKeys)
|
||||
tenantByID.POST("/api-keys", g.Owner(), handler.CreateAPIKey)
|
||||
tenantByID.DELETE("/api-keys/:key_id", g.Owner(), handler.DeleteAPIKey)
|
||||
|
||||
@@ -29,7 +29,6 @@ func TestAPIKeyGateDeniesTenantKeyManagementPaths(t *testing.T) {
|
||||
v1 := engine.Group("/api/v1")
|
||||
tenantByID := v1.Group("/tenants/:id")
|
||||
{
|
||||
tenantByID.POST("/api-key", reachedOK)
|
||||
tenantByID.GET("/api-keys", reachedOK)
|
||||
tenantByID.POST("/api-keys", reachedOK)
|
||||
tenantByID.DELETE("/api-keys/:key_id", reachedOK)
|
||||
@@ -46,7 +45,6 @@ func TestAPIKeyGateDeniesTenantKeyManagementPaths(t *testing.T) {
|
||||
method string
|
||||
path string
|
||||
}{
|
||||
{http.MethodPost, "/api/v1/tenants/42/api-key"},
|
||||
{http.MethodGet, "/api/v1/tenants/42/api-keys"},
|
||||
{http.MethodPost, "/api/v1/tenants/42/api-keys"},
|
||||
{http.MethodDelete, "/api/v1/tenants/42/api-keys/7"},
|
||||
|
||||
@@ -51,7 +51,6 @@ func (s *stubTenantService) UpdateTenant(context.Context, *types.Tenant) (*types
|
||||
panic("unexpected")
|
||||
}
|
||||
func (s *stubTenantService) DeleteTenant(context.Context, uint64) error { panic("unexpected") }
|
||||
func (s *stubTenantService) ExtractTenantIDFromAPIKey(string) (uint64, error) { panic("unexpected") }
|
||||
func (s *stubTenantService) ListAllTenants(context.Context) ([]*types.Tenant, error) {
|
||||
panic("unexpected")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user