jumpserver/apps/users/api/mixins.py

16 lines
399 B
Python
Raw Normal View History

2020-03-20 10:21:27 +00:00
# -*- coding: utf-8 -*-
#
from .. import utils
from users.models import User
2020-03-20 10:21:27 +00:00
2020-06-05 12:15:23 +00:00
from orgs.utils import current_org
2020-03-20 10:21:27 +00:00
class UserQuerysetMixin:
def get_queryset(self):
if self.request.query_params.get('all') or current_org.is_root():
2020-07-20 02:42:22 +00:00
queryset = User.objects.exclude(role=User.ROLE.APP)
else:
queryset = utils.get_current_org_members()
2020-03-20 10:21:27 +00:00
return queryset