diff --git a/openedx/features/course_experience/templates/course_experience/course-outline-fragment.html b/openedx/features/course_experience/templates/course_experience/course-outline-fragment.html
index 7496c929da..2424162444 100644
--- a/openedx/features/course_experience/templates/course_experience/course-outline-fragment.html
+++ b/openedx/features/course_experience/templates/course_experience/course-outline-fragment.html
@@ -5,6 +5,7 @@
<%namespace name='static' file='../static_content.html'/>
<%!
+import json
from datetime import date
from django.utils.translation import ugettext as _
@@ -164,8 +165,9 @@ self_paced = context.get('self_paced', False)
if vertical_is_access_denied:
continue
scored = 'scored' if vertical.get('scored', False) else ''
+ access_restricted = list(vertical.get('all_denial_reasons', []))
%>
-
+
0).
+ """
+ own_denial_reason = {block['authorization_denial_reason']} if 'authorization_denial_reason' in block else set()
+ # Use a list comprehension to force the recursion over all children, rather than just stopping
+ # at the first child that is scored.
+ child_denial_reasons = own_denial_reason.union(
+ *(recurse_mark_auth_denial(child) for child in block.get('children', []))
+ )
+ if child_denial_reasons:
+ block['all_denial_reasons'] = child_denial_reasons
+ return child_denial_reasons
+
course_key = CourseKey.from_string(course_id)
course_usage_key = modulestore().make_course_usage_key(course_key)
@@ -188,6 +202,7 @@ def get_course_outline_block_tree(request, course_id, user=None):
if course_outline_root_block:
populate_children(course_outline_root_block, all_blocks['blocks'])
recurse_mark_scored(course_outline_root_block)
+ recurse_mark_auth_denial(course_outline_root_block)
if user:
set_last_accessed_default(course_outline_root_block)
mark_blocks_completed(