diff --git a/CHANGELOG.rst b/CHANGELOG.rst index bda54186ba6b8a0da1b13ea53c47475d5ab5bdd7..8f895f9c0768647aa0368870fe1faccccc338c57 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -16,6 +16,41 @@ Please See the [releases tab](https://github.com/openedx/xblock-lti-consumer/rel Unreleased ~~~~~~~~~~ +7.2.0 - 2022-12-15 +------------------ + +This release addresses a number of issues with and bugs in sharing personally identifiable information (PII) in LTI +launches. + +* Replaces the PII sharing consent modal with an inline PII sharing consent dialog to better suit the three different + LTI launch types (i.e. ``inline``, ``modal``, and ``new_window``). +* Adds a PII consent dialog for ``inline`` LTI launches. +* Fixes a bug in the ``modal`` LTI launch in LTI 1.3 that was preventing the LTI launch. +* Fixes a bug in evaluating and caching whether PII sharing is enabled via the ``CourseAllowPIISharingInLTIFlag``. + + * This fixes a bug where the PII sharing fields in the LTI XBlock edit menu appeared regardless of the existence or + value of this flag. The PII sharing fields will now always be hidden if either no ``CourseAllowPIISharingInLTIFlag`` + exists for a course or if a ``CourseAllowPIISharingInLTIFlag`` exists for the course but is not enabled. + * This fixes a bug in the backwards compatibility code in ``lti_access_to_learners_editable``. Now, + ``CourseAllowPIISharingInLTIFlag`` will always be created for courses that contain (an) LTI XBlock(s) that have (a) + PII sharing field(s) set to True when a user opens the LTI XBlock edit menu. Before, this would occur inconsistently + due to a bug in the caching code. + +* Enables sharing username and email in LTI 1.3 launches. + + * Adds ``preferred_username`` and ``email`` attributes to the ``Lti1p3LaunchData`` class. The application or context + that instantiates ``Lti1p3LaunchData`` is responsible for ensuring that username and email can be sent via an LTI + 1.3 launch and supplying these data, if appropriate. + +* Adds code to eventually support the value of ``CourseAllowPIISharingInLTIFlag`` controlling PII sharing for a given + course in LTI 1.1 and LTI 1.3 launches. + + * This code does not currently work, because the LTI configuration service is not available or defined in all runtime + contexts. This code works in the LTI XBlock edit menu (i.e. the ``studio_view``), but it does not work in the Studio + preview context (i.e. the ``author_view``) or the LMS (i.e. the ``student_view``). The effect is that + the ``CourseAllowPIISharingInLTIFlag`` can only control the appearance of the username and email PII sharing fields + in the XBlock edit menu; it does not control PII sharing. We plan to fix this bug in the future. + 7.1.0 - 2022-12-09 ------------------ * Add support for platform setting `LTI_NRPS_DISALLOW_PII` to prevent sharing of pii over the names and roles diff --git a/lti_consumer/__init__.py b/lti_consumer/__init__.py index 564229846033e0656995329bc63a9570828be7e2..a2af6c5c15c6008438a52ac0fb5cb27ff166dc6e 100644 --- a/lti_consumer/__init__.py +++ b/lti_consumer/__init__.py @@ -4,4 +4,4 @@ Runtime will load the XBlock class from here. from .apps import LTIConsumerApp from .lti_xblock import LtiConsumerXBlock -__version__ = '7.1.0' +__version__ = '7.2.0' diff --git a/lti_consumer/tests/unit/test_lti_xblock.py b/lti_consumer/tests/unit/test_lti_xblock.py index eb4a8c7198f2dbe050823754de80312d8825ab14..bfc9175abb0beeedb4938e63b5e253f836097c19 100644 --- a/lti_consumer/tests/unit/test_lti_xblock.py +++ b/lti_consumer/tests/unit/test_lti_xblock.py @@ -1596,7 +1596,7 @@ class TestLtiConsumer1p3XBlock(TestCase): @ddt.idata(product([True, False], [True, False], [True, False])) @ddt.unpack - def test_get_lti_1p3_launch_data(self, pii_sharing_enabled, send_username, send_email): + def test_get_lti_1p3_launch_data(self, pii_sharing_enabled, ask_to_send_username, ask_to_send_email): """ Test that get_lti_1p3_launch_data returns an instance of Lti1p3LaunchData with the correct data. """ @@ -1611,8 +1611,11 @@ class TestLtiConsumer1p3XBlock(TestCase): 'edx-platform.is_authenticated': True, 'edx-platform.username': fake_username, } + self.xblock.runtime.service(self, 'user').get_current_user = Mock(return_value=fake_user) self.xblock.runtime.service(self, 'user').get_external_user_id = Mock(return_value="external_user_id") + self.xblock.ask_to_send_username = ask_to_send_username + self.xblock.ask_to_send_email = ask_to_send_email # Mock out get_context_title to avoid calling into the compatability layer. self.xblock.get_context_title = Mock(return_value="context_title") @@ -1639,24 +1642,14 @@ class TestLtiConsumer1p3XBlock(TestCase): } if pii_sharing_enabled: - if send_username: + if ask_to_send_username: expected_launch_data_kwargs["preferred_username"] = fake_username - if send_email: + if ask_to_send_email: expected_launch_data_kwargs["email"] = fake_user_email expected_launch_data = Lti1p3LaunchData( - user_id=1, - user_role="instructor", - config_id=config_id_for_block(self.xblock), - resource_link_id=str(self.xblock.scope_ids.usage_id), - external_user_id="external_user_id", - launch_presentation_document_target="iframe", - message_type="LtiResourceLinkRequest", - context_id=course_key, - context_type=["course_offering"], - context_title="context_title", - context_label=course_key, + **expected_launch_data_kwargs ) self.assertEqual(