mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 11:00:03 -03:30
Use the in operator to test against the Organization membership subquery
If more than one Organization were selected by this subquery, then Postgres would complain with "more than one row returned by a subquery used as an expression". We needed to allow for that case. Annoyingly SQLite3 doesn't seem to care, so writing a py.test test to exercise this isn't feasible under our current development setup.
This commit is contained in:
parent
9c06dc7106
commit
1a72ff4c47
@ -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'))
|
||||
)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user