show org-admins all teams if ALL USERS setting enabled

This commit is contained in:
AlanCoding
2018-06-04 14:25:27 -04:00
parent d250b89f47
commit 74c6c350a1
3 changed files with 18 additions and 2 deletions
+3
View File
@@ -1114,6 +1114,9 @@ class TeamAccess(BaseAccess):
select_related = ('created_by', 'modified_by', 'organization',)
def filtered_queryset(self):
if settings.ORG_ADMINS_CAN_SEE_ALL_USERS and \
(self.user.admin_of_organizations.exists() or self.user.auditor_of_organizations.exists()):
return self.model.objects.all()
return self.model.accessible_objects(self.user, 'read_role')
@check_superuser