'This function handles authentication logic for wiki urls and redirects from
the "root wiki" to the "course wiki" if the user accesses the wiki from a course url'

def process_view(self, request, view_func, view_args, view_kwargs):

    if (not view_func.__module__.startswith('wiki.')):
        return
    if (not request.user.is_authenticated()):
        return redirect(reverse('signin_user'), next=request.path)
    course_id = course_id_from_url(request.path)
    wiki_path = request.path.partition('/wiki/')[2]
    if course_id:
        course_path = '/courses/{}'.format(course_id.to_deprecated_string())
        reverse._transform_url = (lambda url: (course_path + url))
        try:
            course = get_course_with_access(request.user, 'load', course_id)
        except Http404:
            request.META['HTTP_REFERER'] = ''
            return redirect('/wiki/{}'.format(wiki_path))
        if (not course.allow_public_wiki_access):
            is_enrolled = CourseEnrollment.is_enrolled(request.user, course.id)
            is_staff = has_access(request.user, 'staff', course)
            if (not (is_enrolled or is_staff)):
                return redirect('about_course', course_id.to_deprecated_string())
            consent_url = get_enterprise_consent_url(request, course_id)
            if consent_url:
                return redirect(consent_url)
        request.course = course
    else:
        if (not settings.FEATURES.get('ALLOW_WIKI_ROOT_ACCESS', False)):
            raise PermissionDenied()
        return self._redirect_from_referrer(request, wiki_path)
