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):
|
def get_org_users(self, include_app=False):
|
||||||
from users.models import User
|
from users.models import User
|
||||||
if self.is_default():
|
if self.is_real():
|
||||||
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:
|
|
||||||
users = self.users.all()
|
users = self.users.all()
|
||||||
|
else:
|
||||||
|
users = User.objects.all()
|
||||||
if not include_app:
|
if not include_app:
|
||||||
users = users.exclude(role=User.ROLE_APP)
|
users = users.exclude(role=User.ROLE_APP)
|
||||||
return users
|
return users
|
||||||
|
|
|
@ -38,10 +38,7 @@ class UserViewSet(IDInFilterMixin, BulkModelViewSet):
|
||||||
pagination_class = LimitOffsetPagination
|
pagination_class = LimitOffsetPagination
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
queryset = super().get_queryset()
|
queryset = current_org.get_org_users()
|
||||||
if current_org.is_real() or current_org.is_default():
|
|
||||||
org_users = current_org.get_org_users()
|
|
||||||
queryset = queryset.filter(id__in=org_users)
|
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
def get_permissions(self):
|
def get_permissions(self):
|
||||||
|
|
Loading…
Reference in New Issue