Commit 6cbd3539 by ichuang

make masquerade work properly even if DISABLE_START_DATES true

parent 0ffc399f
......@@ -236,7 +236,7 @@ def _has_access_descriptor(user, descriptor, action, course_context=None):
don't have to hit the enrollments table on every module load.
"""
# If start dates are off, can always load
if settings.MITX_FEATURES['DISABLE_START_DATES']:
if settings.MITX_FEATURES['DISABLE_START_DATES'] and not is_masquerading_as_student(user):
debug("Allow: DISABLE_START_DATES")
return True
......
......@@ -90,6 +90,7 @@ def render_accordion(request, course, chapter, section, model_data_cache):
# grab the table of contents
user = User.objects.prefetch_related("groups").get(id=request.user.id)
request.user = user # keep just one instance of User
toc = toc_for_course(user, request, course, chapter, section, model_data_cache)
context = dict([('toc', toc),
......@@ -261,6 +262,7 @@ def index(request, course_id, chapter=None, section=None,
- HTTPresponse
"""
user = User.objects.prefetch_related("groups").get(id=request.user.id)
request.user = user # keep just one instance of User
course = get_course_with_access(user, course_id, 'load', depth=2)
staff_access = has_access(user, course, 'staff')
registered = registered_for_course(course, user)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment