diff --git a/lms/resources/_js_config/__init__.py b/lms/resources/_js_config/__init__.py index b78a62a4ca..c25287b2d3 100644 --- a/lms/resources/_js_config/__init__.py +++ b/lms/resources/_js_config/__init__.py @@ -572,6 +572,9 @@ def _config(self): config["debug"]["tags"].append( "role:instructor" if self._lti_user.is_instructor else "role:learner" ) + config["user"] = { + "display_name": self._lti_user.display_name, + } return config diff --git a/lms/static/scripts/frontend_apps/config.ts b/lms/static/scripts/frontend_apps/config.ts index 0f90fb9b92..b07cb873d4 100644 --- a/lms/static/scripts/frontend_apps/config.ts +++ b/lms/static/scripts/frontend_apps/config.ts @@ -276,6 +276,11 @@ export type ConfigObject = { debug?: DebugInfo; product: Product; + // Only present when an LTI user is logged-in + user?: { + display_name: string; + }; + // Only present in "basic-lti-launch" mode. canvas: { // Only present in Canvas. diff --git a/tests/unit/lms/resources/_js_config/__init___test.py b/tests/unit/lms/resources/_js_config/__init___test.py index 864e7c96a7..6eecfb8edc 100644 --- a/tests/unit/lms/resources/_js_config/__init___test.py +++ b/tests/unit/lms/resources/_js_config/__init___test.py @@ -173,6 +173,9 @@ def test_it( }, "mode": "basic-lti-launch", "rpcServer": {"allowedOrigins": ["http://localhost:5000"]}, + "user": { + "display_name": lti_user.display_name, + }, } @pytest.mark.usefixtures("grouping_plugin")