Skip to content

Commit

Permalink
Merge pull request #2048 from raccoongang/hera-hawthorn-stage
Browse files Browse the repository at this point in the history
HERA RELEASE-2020-05-08 - Fix
HERA-663 - 404 when user with staff status on a course open Instructor tab
  • Loading branch information
sendr authored May 8, 2020
2 parents f414b68 + d10e2ea commit 8a14a09
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lms/djangoapps/hera/middleware.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.http import Http404, HttpResponseRedirect
from django.urls import reverse

from student.models import CourseEnrollmentAllowed
from courseware.access import has_access

from .models import UserOnboarding
from .utils import get_user_active_course_id
Expand Down Expand Up @@ -48,6 +48,10 @@ def process_request(self, request):
is_path_allowed = self.is_allowed(request.path, user)
is_ajax = request.META.get("HTTP_X_REQUESTED_WITH") == 'XMLHttpRequest'
if not user.is_staff:
if '/courses/' in request.path:
course_key = get_user_active_course_id(user)
if has_access(user, 'staff', course_key):
return
if not is_ajax and not is_path_allowed:
raise Http404
if '/media/' in request.path:
Expand Down

0 comments on commit 8a14a09

Please sign in to comment.