mirror of https://github.com/jumpserver/jumpserver
[Update] 默认中可以看到所有用户 (#2102)
parent
f380d82b55
commit
9499a16a8b
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue