Skip to content

Commit

Permalink
feat: learner_home role checks to permission checks
Browse files Browse the repository at this point in the history
  • Loading branch information
hsinkoff committed Jan 12, 2024
1 parent a03e6d6 commit 43e455c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lms/djangoapps/learner_home/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
),
}

Expand Down

0 comments on commit 43e455c

Please sign in to comment.