Skip to content

feat: admin web UI for LTI management commands#283

Merged
italovalcy merged 1 commit into
mainfrom
feat/lti-web-ui
Jul 11, 2026
Merged

feat: admin web UI for LTI management commands#283
italovalcy merged 1 commit into
mainfrom
feat/lti-web-ui

Conversation

@italovalcy

@italovalcy italovalcy commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an admin-only web UI for the LTI management operations that previously existed only as flask lti ... CLI commands, surfaced under the MANAGEMENT sidebar section. Covers: list-registration-tokens, mint-registration-token, purge-retired-keys, rotate-key, and show-public-key.

Approach

Rather than duplicate logic between CLI and web, the operations are extracted into shared helper functions in apps/lti/routes.py (mint_registration_token, get_registration_public_key, rotate_registration_key, purge_retired_keys_op, list_registrations), backed by a small LtiError exception that each layer maps to its own error style — click.ClickException for the CLI, JSON HTTP error for the web. The existing CLI commands now call these helpers, so behavior is unchanged.

Changes

  • apps/lti/routes.py — extracted shared ops; added admin-gated routes (@login_required + @check_user_category(["admin"])):
    • GET /lti/manage — dashboard
    • POST /lti/manage/mint-token
    • GET /lti/manage/public-key
    • POST /lti/manage/rotate-key
    • POST /lti/manage/purge-retired-keys
    • (list-registration-tokens is rendered directly in the dashboard table)
  • apps/lti/keys.py — added list_retired_keys() (name + UTC retire time) for the retired-keys table.
  • apps/templates/pages/lti_management.html — new AdminLTE page: three cards (Registrations, Registration Tokens, Retired Keys) with per-row Public Key / Rotate Key actions and modals for mint/rotate/purge/view. Uses the existing AJAX + toast/sessionStorage pattern.
  • apps/templates/includes/sidebar.html — LTI entry in MANAGEMENT, gated on config.ENABLE_LTI + admin (mirrors the ENABLE_CLABS pattern), so it only appears when the optional module is loaded.
  • tests/test_lti.py — added TestManagementWebUI: role gating, dashboard render, token minting (incl. hash-only storage + label validation), public-key display (+ unknown-issuer 404), key rotation (publish-then-switch, old key retired), and purge.

Testing

  • Full suite: 540 passed (8 new web-UI tests).
  • djlint clean on the new template and sidebar.
  • Local tests: To be done

Add an admin-only web UI (MANAGEMENT sidebar) mirroring the
`flask lti ...` commands: list/mint registration tokens, rotate a
registration key, purge retired keys and show a registration's public
key.

The operations are extracted into shared helpers so the CLI and the web
routes stay in sync; a small LtiError maps to a click.ClickException
(CLI) or a JSON HTTP error (web). Routes are gated with
@check_user_category(["admin"]) and the sidebar link only shows when the
optional "lti" module is enabled.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@italovalcy italovalcy changed the base branch from main to adjust/config July 10, 2026 16:30
Base automatically changed from adjust/config to main July 11, 2026 09:16
@italovalcy italovalcy marked this pull request as ready for review July 11, 2026 09:16
@italovalcy italovalcy merged commit 1914c94 into main Jul 11, 2026
3 checks passed
@italovalcy italovalcy deleted the feat/lti-web-ui branch July 11, 2026 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant