feat(controlplane): filter the API token list by product scope
Merged
JA
2d ago+39+39+01234567890123456789-6-6-0123456789
The scope filter of the API token list has two values: SCOPE_PROJECT and SCOPE_GLOBAL. A client cannot ask for only the tokens that are confined to the projects of a product. A request without a scope returns these tokens together with all other tokens.
This change adds SCOPE_PRODUCT to APITokenServiceListRequest.Scope. The repository already filters by the product scope kind, so the service maps the new value to it.
Behavior
| Scope | Tokens in the result |
|---|---|
SCOPE_UNSPECIFIED | No scope filter |
SCOPE_GLOBAL | Organization-wide tokens: no project, and no product scope |
SCOPE_PROJECT | Project-scoped tokens |
SCOPE_PRODUCT (new) | Product-scoped tokens |
- An organization or instance API token still gets only project tokens, also when it asks for
SCOPE_PRODUCT. - A user that RBAC limits to some projects gets no product tokens, as before. A product token has no project ID.
- The CLI accepts the new value:
chainloop organization api-token list --scope product.
AI disclosure: Claude Code helped to write this change. I reviewed and tested it.