Skip to content

feat: Add UI to list and revoke API access tokens - #1637

Draft
The-9880 wants to merge 6 commits into
mainfrom
feat/access-token-list-revoke
Draft

feat: Add UI to list and revoke API access tokens#1637
The-9880 wants to merge 6 commits into
mainfrom
feat/access-token-list-revoke

Conversation

@The-9880

@The-9880 The-9880 commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Relates to https://github.com/grafana/synthetic-monitoring/issues/529

Implements a basic UI with defined permissions for access token management:
image

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.
@github-actions github-actions Bot added the feature A feature added to the application. label Mar 31, 2026
@cla-assistant

cla-assistant Bot commented Mar 31, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@cla-assistant

cla-assistant Bot commented Mar 31, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions

Copy link
Copy Markdown

Script size changes

Name +/- Main This PR Outcome
[863.js] = 2,210.80 kB 2,210.80 kB
[837.js] New file - 824.31 kB
[datasource/module.js] +1.10% 25.25 kB 25.52 kB
[692.js] +0.71% 20.64 kB 20.79 kB
[503.js] = 17.46 kB 17.46 kB
[663.js] = 5.83 kB 5.83 kB
[module.js] = 5.35 kB 5.35 kB
[156.js] = 1.90 kB 1.90 kB
[270.js] Deleted file 820.46 kB -

Totals

Name +/- Main This PR Outcome
[Scripts] +0.14% 3,107.69 kB 3,111.96 kB
[Non-script Assets] +0.02% 2,685.34 kB 2,685.88 kB
[All] +0.08% 5,793.03 kB 5,797.84 kB

Generated by 🚫 dangerJS against 0842dde

@ckbedwell

Copy link
Copy Markdown
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? 😬

@The-9880

Copy link
Copy Markdown
Contributor Author

@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? 😬

It's not ready for review yet - depends on https://github.com/grafana/synthetic-monitoring-api/pull/2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature A feature added to the application.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants