feat: Add UI to list and revoke API access tokens - #1637
Draft
The-9880 wants to merge 6 commits into
Draft
Conversation
Adds canReadTokens and canDeleteTokens permissions. TanStack Query hooks handle cache invalidation on create/delete. DeleteAccessToken FaroEvent added for telemetry. RBAC test fixtures updated with the new permission keys.
Paginated table shows ID, Created, Last used. The calling token's Revoke button is disabled with a tooltip (using currentTokenId from the API). All other tokens show an enabled Revoke button with a confirmation modal. 16 passing tests.
…gin.json All three access-token permissions (:read, :write, :delete) are scoped identically to Admin only — granted via the 'Admin' and 'Access tokens writer' roles. Editor and Viewer roles have no access-token permissions. Without these declarations Grafana never populates the permission keys in bootData.user.permissions, so canReadTokens and canDeleteTokens were always false regardless of org role, making the token list and revoke column invisible to everyone including Admins.
Use useStyles2/GrafanaTheme2 for consistent styling with the rest of the config page. Add colgroup to pin column widths (ID=60px, Created/Last used=180px, action=90px) so the table does not sprawl. Apply theme border and typography tokens to header cells. Right-align the Revoke button column.
|
|
Script size changes
Totals
|
Contributor
|
@The-9880 -- is this reviewable (well, what I'm really asking is does this PR have any other upstream dependencies)? I/we tend to ignore stuff in draft? 😬 |
Contributor
Author
It's not ready for review yet - depends on https://github.com/grafana/synthetic-monitoring-api/pull/2019 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Relates to https://github.com/grafana/synthetic-monitoring/issues/529
Implements a basic UI with defined permissions for access token management:
