fix: role detail

pull/9455/head
ibuler 2023-02-07 17:51:22 +08:00
parent c87c432c1a
commit fe725106ac
2 changed files with 9 additions and 14 deletions

View File

@ -69,8 +69,8 @@ class RoleViewSet(JMSModelViewSet):
role.users_amount = role_user_amount_mapper.get(role.id, 0)
return queryset
def filter_queryset(self, queryset):
queryset = super().filter_queryset(queryset)
def page_queryset(self, queryset):
queryset = super().page_queryset(queryset)
queryset = self.set_users_amount(queryset)
return queryset

View File

@ -2,27 +2,27 @@
from collections import defaultdict
from django.utils.translation import ugettext as _
from rest_framework.decorators import action
from rest_framework import generics
from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework_bulk import BulkModelViewSet
from common.api import CommonApiMixin
from common.utils import get_logger
from common.api import SuggestionMixin
from common.utils import get_logger
from orgs.utils import current_org, tmp_to_root_org
from rbac.models import Role, RoleBinding
from users.utils import LoginBlockUtil, MFABlockUtils
from .mixins import UserQuerysetMixin
from ..notifications import ResetMFAMsg
from .. import serializers
from ..filters import UserFilter
from ..models import User
from ..notifications import ResetMFAMsg
from ..serializers import (
UserSerializer,
MiniUserSerializer, InviteSerializer
)
from ..models import User
from ..signals import post_user_create
from ..filters import UserFilter
logger = get_logger(__name__)
__all__ = [
@ -53,13 +53,8 @@ class UserViewSet(CommonApiMixin, UserQuerysetMixin, SuggestionMixin, BulkModelV
return queryset
def paginate_queryset(self, queryset):
page = super().paginate_queryset(queryset)
if page:
page = self.set_users_roles_for_cache(page)
else:
self.set_users_roles_for_cache(queryset)
return page
queryset = super().paginate_queryset(queryset) or queryset
return self.set_users_roles_for_cache(queryset)
@action(methods=['get'], detail=False, url_path='suggestions')
def match(self, request, *args, **kwargs):