mirror of https://github.com/jumpserver/jumpserver
fix: role detail
parent
c87c432c1a
commit
fe725106ac
|
@ -69,8 +69,8 @@ class RoleViewSet(JMSModelViewSet):
|
||||||
role.users_amount = role_user_amount_mapper.get(role.id, 0)
|
role.users_amount = role_user_amount_mapper.get(role.id, 0)
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
def filter_queryset(self, queryset):
|
def page_queryset(self, queryset):
|
||||||
queryset = super().filter_queryset(queryset)
|
queryset = super().page_queryset(queryset)
|
||||||
queryset = self.set_users_amount(queryset)
|
queryset = self.set_users_amount(queryset)
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
|
|
|
@ -2,27 +2,27 @@
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
from rest_framework.decorators import action
|
|
||||||
from rest_framework import generics
|
from rest_framework import generics
|
||||||
|
from rest_framework.decorators import action
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework_bulk import BulkModelViewSet
|
from rest_framework_bulk import BulkModelViewSet
|
||||||
|
|
||||||
from common.api import CommonApiMixin
|
from common.api import CommonApiMixin
|
||||||
from common.utils import get_logger
|
|
||||||
from common.api import SuggestionMixin
|
from common.api import SuggestionMixin
|
||||||
|
from common.utils import get_logger
|
||||||
from orgs.utils import current_org, tmp_to_root_org
|
from orgs.utils import current_org, tmp_to_root_org
|
||||||
from rbac.models import Role, RoleBinding
|
from rbac.models import Role, RoleBinding
|
||||||
from users.utils import LoginBlockUtil, MFABlockUtils
|
from users.utils import LoginBlockUtil, MFABlockUtils
|
||||||
from .mixins import UserQuerysetMixin
|
from .mixins import UserQuerysetMixin
|
||||||
from ..notifications import ResetMFAMsg
|
|
||||||
from .. import serializers
|
from .. import serializers
|
||||||
|
from ..filters import UserFilter
|
||||||
|
from ..models import User
|
||||||
|
from ..notifications import ResetMFAMsg
|
||||||
from ..serializers import (
|
from ..serializers import (
|
||||||
UserSerializer,
|
UserSerializer,
|
||||||
MiniUserSerializer, InviteSerializer
|
MiniUserSerializer, InviteSerializer
|
||||||
)
|
)
|
||||||
from ..models import User
|
|
||||||
from ..signals import post_user_create
|
from ..signals import post_user_create
|
||||||
from ..filters import UserFilter
|
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
@ -53,13 +53,8 @@ class UserViewSet(CommonApiMixin, UserQuerysetMixin, SuggestionMixin, BulkModelV
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
def paginate_queryset(self, queryset):
|
def paginate_queryset(self, queryset):
|
||||||
page = super().paginate_queryset(queryset)
|
queryset = super().paginate_queryset(queryset) or queryset
|
||||||
|
return self.set_users_roles_for_cache(queryset)
|
||||||
if page:
|
|
||||||
page = self.set_users_roles_for_cache(page)
|
|
||||||
else:
|
|
||||||
self.set_users_roles_for_cache(queryset)
|
|
||||||
return page
|
|
||||||
|
|
||||||
@action(methods=['get'], detail=False, url_path='suggestions')
|
@action(methods=['get'], detail=False, url_path='suggestions')
|
||||||
def match(self, request, *args, **kwargs):
|
def match(self, request, *args, **kwargs):
|
||||||
|
|
Loading…
Reference in New Issue