feat: admin web UI for LTI management commands#283
Merged
Conversation
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>
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.
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, andshow-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 smallLtiErrorexception that each layer maps to its own error style —click.ClickExceptionfor 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— dashboardPOST /lti/manage/mint-tokenGET /lti/manage/public-keyPOST /lti/manage/rotate-keyPOST /lti/manage/purge-retired-keysapps/lti/keys.py— addedlist_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/sessionStoragepattern.apps/templates/includes/sidebar.html— LTI entry in MANAGEMENT, gated onconfig.ENABLE_LTI+ admin (mirrors theENABLE_CLABSpattern), so it only appears when the optional module is loaded.tests/test_lti.py— addedTestManagementWebUI: 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
djlintclean on the new template and sidebar.