@@ -868,9 +868,10 @@ class TestTeamMembersAPIView(ViewTestMixin):
868868 (admin_1..3 are staff/superuser; regular_1..8 are plain users)
869869
870870 Visibility via filter_allowed_assignments:
871- - Staff/superuser: sees all 11 users (is_admin_or_superuser_check grants VIEW_LIBRARY on lib scopes)
872- - regular_1 (library_user in Org1:LIB1): VIEW_LIBRARY granted → sees Org1 members (3)
873- - regular_3 (library_user in Org2:LIB2): VIEW_LIBRARY granted → sees Org2 members (3)
871+ - Staff/superuser: sees all 11 users (is_admin_or_superuser_check grants MANAGE_LIBRARY_TEAM on lib scopes)
872+ - regular_5 (library_admin in Org3:LIB3): MANAGE_LIBRARY_TEAM granted → sees Org3 members (5)
873+ - regular_1 (library_user in Org1:LIB1): no MANAGE_LIBRARY_TEAM → sees 0
874+ - regular_3 (library_user in Org2:LIB2): no MANAGE_LIBRARY_TEAM → sees 0
874875 - regular_9 (no assignments): sees 0 users
875876 """
876877
@@ -892,21 +893,23 @@ def setUp(self):
892893 @data (
893894 # Staff/superuser sees all users across all scopes
894895 ("admin_1" , 11 ),
895- # regular_1 has LIBRARY_USER in lib:Org1:LIB1 (VIEW_LIBRARY granted) → sees only Org1 members
896- ("regular_1" , 3 ),
897- # regular_3 has LIBRARY_USER in lib:Org2:LIB2 → sees only Org2 members
898- ("regular_3" , 3 ),
896+ # regular_5 has LIBRARY_ADMIN in lib:Org3:LIB3 (MANAGE_LIBRARY_TEAM granted) → sees only Org3 members
897+ ("regular_5" , 5 ),
898+ # regular_1 has LIBRARY_USER in lib:Org1:LIB1 (no MANAGE_LIBRARY_TEAM) → sees nothing
899+ ("regular_1" , 0 ),
900+ # regular_3 has LIBRARY_USER in lib:Org2:LIB2 (no MANAGE_LIBRARY_TEAM) → sees nothing
901+ ("regular_3" , 0 ),
899902 # regular_9 has no assignments → sees nothing
900903 ("regular_9" , 0 ),
901904 )
902905 @unpack
903906 def test_visibility_limited_to_accessible_scopes (self , username : str , expected_count : int ):
904- """Calling user only sees assignments for scopes it has view access to.
907+ """Calling user only sees assignments for scopes it has MANAGE_*_TEAM access to.
905908
906909 Expected result:
907910 - Staff/superuser sees all users across all scopes.
908- - Regular users only see members of scopes they can view .
909- - Users with no assignments see no results.
911+ - Regular users only see members of scopes they can manage the team for .
912+ - Users without MANAGE_*_TEAM permission see no results.
910913 """
911914 user = User .objects .get (username = username )
912915 self .client .force_authenticate (user = user )
0 commit comments