Merge pull request #2675 from wwitzel3/issue-2244

Do not show the read_role child for Teams
This commit is contained in:
Wayne Witzel III 2016-06-28 11:43:05 -04:00 committed by GitHub
commit 4f534122c5
2 changed files with 2 additions and 2 deletions

View File

@ -867,7 +867,7 @@ class TeamRolesList(SubListCreateAttachDetachAPIView):
team = get_object_or_404(Team, pk=self.kwargs['pk'])
if not self.request.user.can_access(Team, 'read', team):
raise PermissionDenied()
return Role.filter_visible_roles(self.request.user, team.member_role.children.all())
return Role.filter_visible_roles(self.request.user, team.member_role.children.all().exclude(pk=team.read_role.pk))
def post(self, request, *args, **kwargs):
# Forbid implicit role creation here

View File

@ -183,7 +183,7 @@ def test_get_teams_roles_list(get, team, organization, admin):
assert response.status_code == 200
roles = response.data
assert roles['count'] == 2
assert roles['count'] == 1
assert roles['results'][0]['id'] == organization.admin_role.id or roles['results'][1]['id'] == organization.admin_role.id