Beispiel #1
0
    def course_access(self) -> dict:
        """
        Can the user load this course in the learning micro-frontend?

        Return a JSON-friendly access response.
        """
        # Only check whether the MFE is enabled if the user would otherwise be allowed to see it
        # This means that if the user was denied access, they'll see a meaningful message first if
        # there is one.
        if self.load_access and not self.is_microfrontend_enabled_for_user():
            return CoursewareMicrofrontendDisabledAccessError().to_json()
        return self.load_access.to_json()
Beispiel #2
0
 def can_load_courseware(self):
     access_response = check_course_access(
         self.overview,
         self.effective_user,
         'load',
         check_if_enrolled=True,
         check_survey_complete=False,
         check_if_authenticated=True,
     ).to_json()
     # Only check whether the MFE is enabled if the user would otherwise be allowed to see it
     # This means that if the user was denied access, they'll see a meaningful message first if
     # there is one.
     if access_response and not self.is_microfrontend_enabled_for_user():
         return CoursewareMicrofrontendDisabledAccessError().to_json()
     return access_response