Let staff have access to a forum even if they're not enrolled in the course.

This commit is contained in:
David Ormsbee
2013-08-19 17:27:23 -04:00
parent c2d1791de4
commit 013009ea24

View File

@@ -169,7 +169,8 @@ def forum_form_discussion(request, course_id):
"""
Renders the main Discussion page, potentially filtered by a search query
"""
if not CourseEnrollment.is_enrolled(request.user, course_id):
if not CourseEnrollment.is_enrolled(request.user, course_id) and \
not has_access(request.user, course_id, 'staff'):
access_violation_msg = "Unenrolled user {} tried to access forum for {}"
log.warning(access_violation_msg.format(request.user, course_id))
raise Http404