Skip to content

Commit

Permalink
Merge pull request #572 from open-craft/0x29a/bb7489/eshe-instructor
Browse files Browse the repository at this point in the history
fix: eSHE instructors should see their courses [BB-7489]
  • Loading branch information
0x29a authored Aug 14, 2023
2 parents 48c3b81 + 8d2d3c9 commit 7ae6d22
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions common/djangoapps/student/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def __init__(self, user):
)

@staticmethod
def _get_roles(role):
def get_roles(role):
"""
Return the roles that should have the same permissions as the specified role.
"""
Expand All @@ -102,7 +102,7 @@ def has_role(self, role, course_id, org):
or a role that inherits from the specified role, course_id and org.
"""
return any(
access_role.role in self._get_roles(role) and
access_role.role in self.get_roles(role) and
access_role.course_id == course_id and
access_role.org == org
for access_role in self._roles
Expand Down Expand Up @@ -483,11 +483,11 @@ def remove_courses(self, *course_keys):

def courses_with_role(self):
"""
Return a django QuerySet for all of the courses with this user x role. You can access
Return a django QuerySet for all of the courses with this user x (or derived from x) role. You can access
any of these properties on each result record:
* user (will be self.user--thus uninteresting)
* org
* course_id
* role (will be self.role--thus uninteresting)
"""
return CourseAccessRole.objects.filter(role=self.role, user=self.user)
return CourseAccessRole.objects.filter(role__in=RoleCache.get_roles(self.role), user=self.user)

0 comments on commit 7ae6d22

Please sign in to comment.