feat(mcp): admin account-lifecycle UI, instances unreadable #125
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/YT-71-admin-account-lifecycle"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Rebuild the admin surface around the local-account lifecycle (YT-69 dropped the Hub allowlist this replaces).
GET /adminandGET /admin/accountsrender one account-lifecycle view listing every account with email, status, admin flag, TOTP state, created-at, and a connected boolean. Per-account actions are ban, unban, force-logout, reset second factor, and delete; every route is gated onis_adminand rejects a banned admin through the existingrequire_admingate.The product boundary is that an administrator must not see which YouTrack instance a user has configured. This is enforced at the query layer, not in a handler or template filter: the admin list is built by
list_admin_account_rows, whose SELECT computes onlyEXISTS(youtrack_instances)as a boolean and never projectsbase_urlortoken_enc. A column that is never selected cannot leak into a view. A regression test drives an account that has both a base URL and a token configured and asserts no admin response contains either, while the connected column still reads yes.Force-logout revokes the account's app-issued access and refresh tokens and invalidates its browser session without banning it. The browser session is a stateless signed cookie with no server-side row, so it is revoked by advancing a new
session_epochon the account (migration 0005): the session stamps the epoch it was minted at, andcurrent_accountaccepts it only while the two still match.force_logout_accountbumps the epoch and revokes both token kinds in one transaction; the account stays active and signs back in to mint a fresh session at the new epoch.An admin cannot ban or delete their own account, so a deployment cannot be left with no administrator and no recovery short of database surgery. Reset second factor clears the TOTP secret, enrolment, spent-step marker, and recovery codes so a user who lost their authenticator can sign in with the password alone and re-enrol.
#YT-71