From 43e455c9d0abcaf06be4623364f860c7eba43794 Mon Sep 17 00:00:00 2001 From: hsinkoff <10408711+hsinkoff@users.noreply.github.com> Date: Fri, 22 Dec 2023 17:05:56 +0000 Subject: [PATCH] feat: learner_home role checks to permission checks --- lms/djangoapps/learner_home/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lms/djangoapps/learner_home/views.py b/lms/djangoapps/learner_home/views.py index 1fa115be5890..23c3ead2e965 100644 --- a/lms/djangoapps/learner_home/views.py +++ b/lms/djangoapps/learner_home/views.py @@ -53,6 +53,7 @@ get_masquerade_user, ) from openedx.core.djangoapps.content.course_overviews.models import CourseOverview +from openedx.core.djangoapps.course_roles.data import CourseRolesPermission from openedx.core.djangoapps.programs.utils import ProgramProgressMeter from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers from openedx.core.lib.api.authentication import BearerAuthenticationAllowInactiveUser @@ -327,10 +328,12 @@ def check_course_access(user, course_enrollments): "is_too_early_to_view": not check_course_open_for_learner( user, course_enrollment.course ), + # TODO: remove role checks once course_roles is fully impelented and data is migrated "user_has_staff_access": any( administrative_accesses_to_course_for_user( user, course_enrollment.course_id - ) + ) or + user.has_perm(CourseRolesPermission.VIEW_ALL_CONTENT.perm_name) ), }