diff --git a/cms/envs/common.py b/cms/envs/common.py index e2a7b375b839..b85fa90c0229 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -2284,7 +2284,6 @@ ############################ OAUTH2 Provider ################################### - # 5 minute expiration time for JWT id tokens issued for external API requests. OAUTH_ID_TOKEN_EXPIRATION = 5 * 60 @@ -2300,6 +2299,12 @@ API_DOCUMENTATION_URL = 'https://course-catalog-api-guide.readthedocs.io/en/latest/' AUTH_DOCUMENTATION_URL = 'https://course-catalog-api-guide.readthedocs.io/en/latest/authentication/index.html' +EDX_DRF_EXTENSIONS = { + # Set this value to an empty dict in order to prevent automatically updating + # user data from values in (possibly stale) JWTs. + 'JWT_PAYLOAD_USER_ATTRIBUTE_MAPPING': {}, +} + ############## Settings for Studio Context Sensitive Help ############## HELP_TOKENS_INI_FILE = REPO_ROOT / "cms" / "envs" / "help_tokens.ini" diff --git a/lms/djangoapps/certificates/views/webview.py b/lms/djangoapps/certificates/views/webview.py index 4d99b7d7722d..eddddbb88717 100644 --- a/lms/djangoapps/certificates/views/webview.py +++ b/lms/djangoapps/certificates/views/webview.py @@ -458,14 +458,15 @@ def _update_organization_context(context, course): Updates context with organization related info. """ partner_long_name, organization_logo = None, None - partner_short_name = course.display_organization if course.display_organization else course.org + course_org_display = course.display_organization organizations = organizations_api.get_course_organizations(course_key=course.id) if organizations: # TODO Need to add support for multiple organizations, Currently we are interested in the first one. organization = organizations[0] partner_long_name = organization.get('name', partner_long_name) - partner_short_name = organization.get('short_name', partner_short_name) + course_org_display = course_org_display or organization.get('short_name') organization_logo = organization.get('logo', None) + partner_short_name = course_org_display or course.org context['organization_long_name'] = partner_long_name context['organization_short_name'] = partner_short_name diff --git a/lms/djangoapps/course_api/blocks/utils.py b/lms/djangoapps/course_api/blocks/utils.py index 3a9fea117c23..0af24b951ade 100644 --- a/lms/djangoapps/course_api/blocks/utils.py +++ b/lms/djangoapps/course_api/blocks/utils.py @@ -1,6 +1,8 @@ """ Utils for Blocks """ +from rest_framework.utils.serializer_helpers import ReturnList + from openedx.core.djangoapps.discussions.models import ( DiscussionsConfiguration, Provider, @@ -15,16 +17,28 @@ def filter_discussion_xblocks_from_response(response, course_key): provider = configuration.provider_type if provider == Provider.OPEN_EDX: # Finding ids of discussion xblocks - discussion_xblocks = [ - key for key, value in response.data.get('blocks', {}).items() - if value.get('type') == 'discussion' - ] + if isinstance(response.data, ReturnList): + discussion_xblocks = [ + value.get('id') for value in response.data if value.get('type') == 'discussion' + ] + else: + discussion_xblocks = [ + key for key, value in response.data.get('blocks', {}).items() + if value.get('type') == 'discussion' + ] # Filtering discussion xblocks keys from blocks - filtered_blocks = { - key: value - for key, value in response.data.get('blocks', {}).items() - if value.get('type') != 'discussion' - } + if isinstance(response.data, ReturnList): + filtered_blocks = { + value.get('id'): value + for value in response.data + if value.get('type') != 'discussion' + } + else: + filtered_blocks = { + key: value + for key, value in response.data.get('blocks', {}).items() + if value.get('type') != 'discussion' + } # Removing reference of discussion xblocks from unit # These references needs to be removed because they no longer exist for _, block_data in filtered_blocks.items(): @@ -36,5 +50,8 @@ def filter_discussion_xblocks_from_response(response, course_key): if descendant not in discussion_xblocks ] block_data[key] = descendants - response.data['blocks'] = filtered_blocks + if isinstance(response.data, ReturnList): + response.data = filtered_blocks + else: + response.data['blocks'] = filtered_blocks return response diff --git a/lms/djangoapps/course_home_api/progress/serializers.py b/lms/djangoapps/course_home_api/progress/serializers.py index 190cd76bf9b5..6bdc204434af 100644 --- a/lms/djangoapps/course_home_api/progress/serializers.py +++ b/lms/djangoapps/course_home_api/progress/serializers.py @@ -145,3 +145,4 @@ class ProgressTabSerializer(VerifiedModeSerializer): username = serializers.CharField() user_has_passing_grade = serializers.BooleanField() verification_data = VerificationDataSerializer() + disable_progress_graph = serializers.BooleanField() diff --git a/lms/djangoapps/course_home_api/progress/views.py b/lms/djangoapps/course_home_api/progress/views.py index 8c21335dcacf..3783c19061dc 100644 --- a/lms/djangoapps/course_home_api/progress/views.py +++ b/lms/djangoapps/course_home_api/progress/views.py @@ -230,6 +230,7 @@ def get(self, request, *args, **kwargs): block = modulestore().get_course(course_key) grading_policy = block.grading_policy + disable_progress_graph = block.disable_progress_graph verification_status = IDVerificationService.user_status(student) verification_link = None if verification_status['status'] is None or verification_status['status'] == 'expired': @@ -259,6 +260,7 @@ def get(self, request, *args, **kwargs): 'username': username, 'user_has_passing_grade': user_has_passing_grade, 'verification_data': verification_data, + 'disable_progress_graph': disable_progress_graph, } context = self.get_serializer_context() context['staff_access'] = is_staff diff --git a/lms/static/js/instructor_dashboard/membership.js b/lms/static/js/instructor_dashboard/membership.js index 5fdf4a42ef63..0cdb6d28330a 100644 --- a/lms/static/js/instructor_dashboard/membership.js +++ b/lms/static/js/instructor_dashboard/membership.js @@ -503,14 +503,20 @@ such that the value can be defined later than this assignment (file load order). })); $idsList = $('