New token form: only templates within what the token's user may do

A token never does more than its user, so offering wider templates only
misled. On the Users page the templates follow the token's user, not the
administrator making it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
adamandClaude Opus 5.5 committed 2026-10-14 13:42:37 +01:00
1 parent 5cd22f52d4
commit 0e663ab36c
3 files changed
+21 -5

No files matched your search

+1 -1
View File
@@ -9,7 +9,7 @@ export async function render(el) {
const tokensEl = h("div");
const drawTokens = async () => {
const tokens = await get("/me/tokens");
mount(tokensEl, tokenTable(tokens, drawTokens), newTokenForm("/me/tokens", grants, drawTokens));
mount(tokensEl, tokenTable(tokens, drawTokens), newTokenForm("/me/tokens", grants, drawTokens, { admin: me.admin, grants: me.user.grants }));
};
const cur = input({ type: "password", autocomplete: "current-password" });
const pw1 = input({ type: "password", autocomplete: "new-password" });