mirror of
https://github.com/ansible/awx.git
synced 2026-03-06 11:11:07 -03:30
Fix up the project teams list
This was still referencing the old mechanism for pulling associative information. This updates it to query against the new role system
This commit is contained in:
@@ -979,12 +979,19 @@ class ProjectPlaybooks(RetrieveAPIView):
|
||||
model = Project
|
||||
serializer_class = ProjectPlaybooksSerializer
|
||||
|
||||
class ProjectTeamsList(SubListCreateAttachDetachAPIView):
|
||||
class ProjectTeamsList(ListAPIView):
|
||||
|
||||
model = Team
|
||||
serializer_class = TeamSerializer
|
||||
parent_model = Project
|
||||
relationship = 'teams'
|
||||
|
||||
def get_queryset(self):
|
||||
p = get_object_or_404(Project, pk=self.kwargs['pk'])
|
||||
if not self.request.user.can_access(Project, 'read', p):
|
||||
raise PermissionDenied()
|
||||
project_ct = ContentType.objects.get_for_model(Project)
|
||||
team_ct = ContentType.objects.get_for_model(self.model)
|
||||
all_roles = Role.objects.filter(Q(descendents__content_type=project_ct) & Q(descendents__object_id=p.pk), content_type=team_ct)
|
||||
return self.model.objects.filter(pk__in=[t.content_object.pk for t in all_roles])
|
||||
|
||||
class ProjectSchedulesList(SubListCreateAttachDetachAPIView):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user