mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add multi-scope support to API keys (#19917)
# Canonicalize API Key Scopes This PR introduces canonical API key scopes with a `coder:` namespace prefix to avoid collisions with low-level resource:action names. It: 1. Renames special API key scopes in the database: - `all` → `coder:all` - `application_connect` → `coder:application_connect` 2. Adds support for a new `scopes` field in the API key creation request, allowing multiple scopes to be specified while maintaining backward compatibility with the singular `scope` field. 3. Updates the API documentation to reflect these changes, including the new endpoint for listing public API key scopes. 4. Ensures backward compatibility by mapping between legacy and canonical scope names in relevant code paths.
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
-- Revert canonicalization of special API key scopes
|
||||
-- Rename enum values back: 'coder:all' -> 'all', 'coder:application_connect' -> 'application_connect'
|
||||
|
||||
ALTER TYPE api_key_scope RENAME VALUE 'coder:all' TO 'all';
|
||||
ALTER TYPE api_key_scope RENAME VALUE 'coder:application_connect' TO 'application_connect';
|
||||
@@ -0,0 +1,5 @@
|
||||
-- Canonicalize special API key scopes to coder:* namespace
|
||||
-- Rename enum values: 'all' -> 'coder:all', 'application_connect' -> 'coder:application_connect'
|
||||
|
||||
ALTER TYPE api_key_scope RENAME VALUE 'all' TO 'coder:all';
|
||||
ALTER TYPE api_key_scope RENAME VALUE 'application_connect' TO 'coder:application_connect';
|
||||
Reference in New Issue
Block a user