feat: Deny course staff visibility of legacy courseware. (#27469)
Currently, course staff can always view their courses in the Legacy courseware experience. With this change, course staff will *not* be able to view their courses if the New (MFE) courseware experience has been enabled for them. This does not affect global staff, and it does not affect courses that are still running in the Legacy experience. Adds a new parameter returned by the course metadata API used by the courseware MFE to determine if the button to show legacy experience should be displayed or not. TNL-8203
This commit is contained in:
@@ -104,6 +104,7 @@ class CourseInfoSerializer(serializers.Serializer): # pylint: disable=abstract-
|
||||
verified_mode = serializers.DictField()
|
||||
show_calculator = serializers.BooleanField()
|
||||
original_user_is_staff = serializers.BooleanField()
|
||||
can_view_legacy_courseware = serializers.BooleanField()
|
||||
is_staff = serializers.BooleanField()
|
||||
can_load_courseware = serializers.DictField()
|
||||
notes = serializers.DictField()
|
||||
|
||||
@@ -33,7 +33,11 @@ from lms.djangoapps.courseware.courses import check_course_access
|
||||
from lms.djangoapps.courseware.masquerade import setup_masquerade
|
||||
from lms.djangoapps.courseware.module_render import get_module_by_usage_id
|
||||
from lms.djangoapps.courseware.tabs import get_course_tab_list
|
||||
from lms.djangoapps.courseware.toggles import courseware_mfe_is_visible, course_exit_page_is_active
|
||||
from lms.djangoapps.courseware.toggles import (
|
||||
courseware_legacy_is_visible,
|
||||
courseware_mfe_is_visible,
|
||||
course_exit_page_is_active
|
||||
)
|
||||
from lms.djangoapps.courseware.views.views import get_cert_data
|
||||
from lms.djangoapps.grades.api import CourseGradeFactory
|
||||
from lms.djangoapps.verify_student.services import IDVerificationService
|
||||
@@ -93,6 +97,10 @@ class CoursewareMeta:
|
||||
self.is_staff = has_access(self.effective_user, 'staff', self.overview).has_access
|
||||
self.enrollment_object = CourseEnrollment.get_enrollment(self.effective_user, self.course_key,
|
||||
select_related=['celebration', 'user__celebration'])
|
||||
self.can_view_legacy_courseware = courseware_legacy_is_visible(
|
||||
course_key=course_key,
|
||||
is_global_staff=self.original_user_is_global_staff,
|
||||
)
|
||||
|
||||
def __getattr__(self, name):
|
||||
return getattr(self.overview, name)
|
||||
@@ -386,6 +394,7 @@ class CoursewareInformation(RetrieveAPIView):
|
||||
* can_load_course: Whether the user can view the course (AccessResponse object)
|
||||
* is_staff: Whether the effective user has staff access to the course
|
||||
* original_user_is_staff: Whether the original user has staff access to the course
|
||||
* can_view_legacy_courseware: Indicates whether the user is able to see the legacy courseware view
|
||||
* user_has_passing_grade: Whether or not the effective user's grade is equal to or above the courses minimum
|
||||
passing grade
|
||||
* course_exit_page_is_active: Flag for the learning mfe on whether or not the course exit page should display
|
||||
|
||||
Reference in New Issue
Block a user