diff --git a/lms/djangoapps/teams/csv.py b/lms/djangoapps/teams/csv.py index f4a873b3511eb39f869316d3f0936720a20b1549..c23f7ddb2e45ccae45034f29ee01077ba1341d55 100644 --- a/lms/djangoapps/teams/csv.py +++ b/lms/djangoapps/teams/csv.py @@ -371,16 +371,12 @@ class TeamMembershipImportManager(object): if(teamset_id, team_name) not in self.user_enrollment_by_team: self.user_enrollment_by_team[teamset_id, team_name] = set() self.user_enrollment_by_team[teamset_id, team_name].add(self.user_to_actual_enrollment_mode[user.id]) - if self.is_FERPA_bubble_breached(teamset_id, team_name): + if self.is_FERPA_bubble_breached(teamset_id, team_name) or \ + not self.is_enrollment_protection_for_existing_team_matches_user(user, team_name, teamset_id): error_message = \ 'Team {} cannot have Master’s track users mixed with users in other tracks.'.format(team_name) self.add_error_and_check_if_max_exceeded(error_message) return False - if not self.is_enrollment_protection_for_existing_team_matches_user(user, team_name, teamset_id): - error_message = \ - 'User {} does not have access to team {}.'.format(user.username, team_name) - self.add_error_and_check_if_max_exceeded(error_message) - return False return True def is_enrollment_protection_for_existing_team_matches_user(self, user, team_name, teamset_id): diff --git a/lms/djangoapps/teams/tests/test_views.py b/lms/djangoapps/teams/tests/test_views.py index 4b110a05fd98a4524df6733a0fda0f30a70177e1..b5f5ff5ef2fa35eea28c6d30e13075eaf928718f 100644 --- a/lms/djangoapps/teams/tests/test_views.py +++ b/lms/djangoapps/teams/tests/test_views.py @@ -3101,8 +3101,7 @@ class TestBulkMembershipManagement(TeamAPITestCase): user='staff' ) response_text = json.loads(response.content.decode('utf-8')) - expected_message = 'User {} does not have access to team {}.'.format( - masters_a, + expected_message = 'Team {} cannot have Master’s track users mixed with users in other tracks.'.format( team.name ) self.assertEqual(response_text['errors'][0], expected_message)