[Update] 默认中可以看到所有用户 (#2102)

pull/2111/head
老广 2018-11-27 11:00:39 +08:00 committed by GitHub
parent f380d82b55
commit 9499a16a8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 11 deletions

View File

@ -68,14 +68,10 @@ class Organization(models.Model):
def get_org_users(self, include_app=False):
from users.models import User
if self.is_default():
users = User.objects.filter(orgs__isnull=True)
elif not self.is_real():
users = User.objects.all()
elif self.is_root():
users = User.objects.all()
else:
if self.is_real():
users = self.users.all()
else:
users = User.objects.all()
if not include_app:
users = users.exclude(role=User.ROLE_APP)
return users

View File

@ -38,10 +38,7 @@ class UserViewSet(IDInFilterMixin, BulkModelViewSet):
pagination_class = LimitOffsetPagination
def get_queryset(self):
queryset = super().get_queryset()
if current_org.is_real() or current_org.is_default():
org_users = current_org.get_org_users()
queryset = queryset.filter(id__in=org_users)
queryset = current_org.get_org_users()
return queryset
def get_permissions(self):