Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lms/djangoapps/instructor/authz/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ def has_course_team_access(user: AbstractUser, course_key: CourseKey) -> bool:
"""
Check the access to the course team.

It follows the same rule as ``CourseTeamPermission``
(``lms.djangoapps.instructor.permissions``).
It is the pre-AuthZ rule of the course team endpoints.

Args:
user (AbstractUser): The user to check.
Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/instructor/authz/tests/test_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def test_instructor_access(self, user_type):
@ddt.ddt
class CourseTeamAccessTest(TestCase):
"""
``has_course_team_access`` follows the rule of ``CourseTeamPermission``.
``has_course_team_access`` follows the pre-AuthZ rule of the course team endpoints.
"""

@ddt.data(*USER_TYPES)
Expand Down
20 changes: 0 additions & 20 deletions lms/djangoapps/instructor/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,26 +94,6 @@ def has_permission(self, request, view):
return request.user.has_perm(permission, course)


class CourseTeamPermission(BasePermission):
"""
Allow access to course team management endpoints for users with
instructor (Admin) access or the Discussion Admin (staff + forum Administrator) role.
"""
def has_permission(self, request, view):
try:
course_key = CourseKey.from_string(view.kwargs.get('course_id'))
except InvalidKeyError as exc:
raise Http404('Invalid course key') from exc
course = get_course_by_id(course_key)
if has_access(request.user, 'instructor', course):
return True
if has_access(request.user, 'staff', course) and has_forum_access(
request.user, course_key, FORUM_ROLE_ADMINISTRATOR
):
return True
return False


class ForumAdminRequiresInstructorAccess(BasePermission):
"""
default roles require either (staff & forum admin) or (instructor)
Expand Down
Loading
Loading