1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +03:00

Merge pull request #4112 from jbradberry/fix-3603

Use the `in` operator to test against the Organization membership subquery

Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
softwarefactory-project-zuul[bot] 2019-06-20 12:56:08 +00:00 committed by GitHub
commit e269634afc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1265,7 +1265,7 @@ class TeamAccess(BaseAccess):
(self.user.admin_of_organizations.exists() or self.user.auditor_of_organizations.exists()):
return self.model.objects.all()
return self.model.objects.filter(
Q(organization=Organization.accessible_pk_qs(self.user, 'member_role')) |
Q(organization__in=Organization.accessible_pk_qs(self.user, 'member_role')) |
Q(pk__in=self.model.accessible_pk_qs(self.user, 'read_role'))
)