2020-03-20 10:21:27 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
from .. import utils
|
2020-05-06 07:31:08 +00:00
|
|
|
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):
|
2021-03-02 06:57:48 +00:00
|
|
|
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)
|
2020-05-06 07:31:08 +00:00
|
|
|
else:
|
|
|
|
queryset = utils.get_current_org_members()
|
2020-03-20 10:21:27 +00:00
|
|
|
return queryset
|