示例#1
0
 def _redirect_if_needed_to_register(self):
     """
     Verify that the user is registered in the course.
     """
     if not registered_for_course(self.course, self.effective_user):
         log.debug(u'User %s tried to view course %s but is not enrolled',
                   self.effective_user, unicode(self.course.id))
         user_is_global_staff = GlobalStaff().has_user(self.effective_user)
         user_is_enrolled = CourseEnrollment.is_enrolled(
             self.effective_user, self.course_key)
         if user_is_global_staff and not user_is_enrolled:
             redirect_url = get_redirect_url_for_global_staff(
                 self.course_key, _next=self.url)
             raise Redirect(redirect_url)
         raise Redirect(
             reverse('about_course', args=[unicode(self.course.id)]))
示例#2
0
 def _redirect_if_needed_to_register(self):
     """
     Verify that the user is registered in the course.
     """
     if not registered_for_course(self.course, self.effective_user):
         log.debug(
             u'User %s tried to view course %s but is not enrolled',
             self.effective_user,
             unicode(self.course.id)
         )
         user_is_global_staff = GlobalStaff().has_user(self.effective_user)
         user_is_enrolled = CourseEnrollment.is_enrolled(self.effective_user, self.course_key)
         if user_is_global_staff and not user_is_enrolled:
             redirect_url = get_redirect_url_for_global_staff(self.course_key, _next=self.url)
             raise Redirect(redirect_url)
         raise Redirect(reverse('about_course', args=[unicode(self.course.id)]))