Skip to content

Commit

Permalink
feat: teams 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 43e455c commit 1ad5236
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lms/djangoapps/teams/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from lms.djangoapps.courseware.courses import has_access
from lms.djangoapps.discussion.django_comment_client.utils import has_discussion_privileges
from lms.djangoapps.teams.models import CourseTeam, CourseTeamMembership
from openedx.core.djangoapps.course_roles.data import CourseRolesPermission
from openedx.core.lib.teams_config import TeamsetType
from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order

Expand Down Expand Up @@ -144,6 +145,9 @@ def has_course_staff_privileges(user, course_key):
return True
if CourseInstructorRole(course_key).has_user(user):
return True
# TODO: remove role checks once course_roles is fully impelented and data is migrated
if user.has_perm(CourseRolesPermission.MANAGE_STUDENTS.perm_name):
return True
return False


Expand All @@ -160,6 +164,7 @@ def has_team_api_access(user, course_key, access_username=None):
Returns:
bool: True if the user has access, False otherwise.
"""
# TODO: remove role checks once course_roles is fully impelented and data is migrated
if has_course_staff_privileges(user, course_key):
return True
if has_discussion_privileges(user, course_key):
Expand Down

0 comments on commit 1ad5236

Please sign in to comment.