2828 CourseOverviewData ,
2929 OrgContentLibraryGlobData ,
3030 OrgCourseOverviewGlobData ,
31+ PlatformGlobData ,
3132 RoleAssignmentData ,
3233 SuperAdminAssignmentData ,
3334 UserAssignmentData ,
@@ -256,7 +257,9 @@ class RoleUserAPIView(APIView):
256257 **Authentication and Permissions**
257258
258259 - Requires authenticated user.
259- - Requires ``manage_library_team`` permission for the scope.
260+
261+ - GET: Requires ``view_library_team`` or ``view_course_team`` permission according to the scope.
262+ - PUT and DELETE: Requires ``manage_library_team`` or ``manage_course_team`` permission according to the scope.
260263
261264 **Example Request**
262265
@@ -784,7 +787,7 @@ def _get_allowed_scope_queryset(
784787 * ,
785788 username : str ,
786789 scope_cls : type ,
787- glob_cls : type ,
790+ org_glob_cls : type ,
788791 get_permission : callable ,
789792 queryset_builder : callable ,
790793 extract_ids : callable ,
@@ -801,7 +804,7 @@ def _get_allowed_scope_queryset(
801804 Args:
802805 username: The username to check permissions for.
803806 scope_cls: The concrete scope data class (e.g., CourseOverviewData).
804- glob_cls : The org-level glob class (e.g., OrgCourseOverviewGlobData).
807+ org_glob_cls : The org-level glob class (e.g., OrgCourseOverviewGlobData).
805808 get_permission: Callable that returns the permission for a scope class.
806809 queryset_builder: Callable that builds the filtered queryset (e.g., _get_courses_queryset).
807810 extract_ids: Callable that extracts specific IDs from non-glob scopes.
@@ -812,9 +815,14 @@ def _get_allowed_scope_queryset(
812815 QuerySet: The filtered queryset projected to the unified scope shape.
813816 """
814817 allowed_scopes = get_scopes_for_user_and_permission (username , get_permission (scope_cls ).identifier )
815- specific_scopes = [s for s in allowed_scopes if not isinstance (s , glob_cls )]
818+
819+ has_platform_access = any (isinstance (s , PlatformGlobData ) for s in allowed_scopes )
820+ if has_platform_access :
821+ return queryset_builder (allowed_ids = None , allowed_orgs = None , search = search , orgs = orgs )
822+
823+ specific_scopes = [s for s in allowed_scopes if not s .IS_GLOB ]
816824 allowed_ids = extract_ids (specific_scopes )
817- allowed_orgs = {s .org for s in allowed_scopes if isinstance (s , glob_cls )}
825+ allowed_orgs = {s .org for s in allowed_scopes if isinstance (s , org_glob_cls )}
818826 return queryset_builder (allowed_ids , allowed_orgs , search = search , orgs = orgs )
819827
820828 def _build_queryset (self , courses_qs : QuerySet | None , libraries_qs : QuerySet | None ) -> QuerySet :
@@ -873,7 +881,7 @@ def get_permission(scope_cls):
873881 courses_qs = self ._get_allowed_scope_queryset (
874882 username = user .username ,
875883 scope_cls = CourseOverviewData ,
876- glob_cls = OrgCourseOverviewGlobData ,
884+ org_glob_cls = OrgCourseOverviewGlobData ,
877885 get_permission = get_permission ,
878886 queryset_builder = self ._get_courses_queryset ,
879887 extract_ids = lambda scopes : {s .external_key for s in scopes },
@@ -886,7 +894,7 @@ def get_permission(scope_cls):
886894 libraries_qs = self ._get_allowed_scope_queryset (
887895 username = user .username ,
888896 scope_cls = ContentLibraryData ,
889- glob_cls = OrgContentLibraryGlobData ,
897+ org_glob_cls = OrgContentLibraryGlobData ,
890898 get_permission = get_permission ,
891899 queryset_builder = self ._get_libraries_queryset ,
892900 extract_ids = lambda scopes : {
0 commit comments