From 3bf8177b40eaeddc7e67029067ecfbae89c5f8a4 Mon Sep 17 00:00:00 2001 From: Anas Hameed <68567262+Anas-hameed@users.noreply.github.com> Date: Tue, 6 Aug 2024 19:13:56 +0500 Subject: [PATCH] Fix: fix the panel role filters issue. (#572) Co-authored-by: Anas Hameed --- common/djangoapps/student/auth.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/djangoapps/student/auth.py b/common/djangoapps/student/auth.py index 1a655b10ca1b..83ea2e3776b0 100644 --- a/common/djangoapps/student/auth.py +++ b/common/djangoapps/student/auth.py @@ -44,13 +44,13 @@ def is_ccx_course(course_key): return isinstance(course_key, CCXLocator) or isinstance(course_key, CCXBlockUsageLocator) -def user_has_role(user, role): +def user_has_role(user, role, check_auth=True): """ Check whether this user has access to this role (either direct or implied) :param user: :param role: an AccessRole """ - if not user.is_active: + if check_auth and not user.is_active: return False # do cheapest check first even tho it's not the direct one if GlobalStaff().has_user(user): @@ -64,7 +64,7 @@ def user_has_role(user, role): if not settings.FEATURES.get('ENABLE_CREATOR_GROUP', False): return True - if role.has_user(user): + if role.has_user(user, check_auth): return True # if not, then check inferred permissions if (isinstance(role, (CourseStaffRole, CourseBetaTesterRole)) and