mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-25 06:42:49 +00:00
fix: 授权 API 顺序整理
This commit is contained in:
@@ -40,8 +40,7 @@ class AssetPermissionUserRelationViewSet(RelationMixin):
|
||||
|
||||
def get_queryset(self):
|
||||
queryset = super().get_queryset()
|
||||
queryset = queryset \
|
||||
.annotate(user_display=F('user__name'))
|
||||
queryset = queryset.annotate(user_display=F('user__name'))
|
||||
return queryset
|
||||
|
||||
|
||||
@@ -69,8 +68,7 @@ class AssetPermissionUserGroupRelationViewSet(RelationMixin):
|
||||
|
||||
def get_queryset(self):
|
||||
queryset = super().get_queryset()
|
||||
queryset = queryset \
|
||||
.annotate(usergroup_display=F('usergroup__name'))
|
||||
queryset = queryset.annotate(usergroup_display=F('usergroup__name'))
|
||||
return queryset
|
||||
|
||||
|
||||
@@ -84,8 +82,7 @@ class AssetPermissionAssetRelationViewSet(RelationMixin):
|
||||
|
||||
def get_queryset(self):
|
||||
queryset = super().get_queryset()
|
||||
queryset = queryset \
|
||||
.annotate(asset_display=F('asset__name'))
|
||||
queryset = queryset.annotate(asset_display=F('asset__name'))
|
||||
return queryset
|
||||
|
||||
|
||||
@@ -111,7 +108,6 @@ class AssetPermissionNodeRelationViewSet(RelationMixin):
|
||||
|
||||
def get_queryset(self):
|
||||
queryset = super().get_queryset()
|
||||
queryset = queryset \
|
||||
.annotate(node_key=F('node__key'))
|
||||
queryset = queryset.annotate(node_key=F('node__key'))
|
||||
return queryset
|
||||
|
||||
|
@@ -32,15 +32,15 @@ class UserDirectGrantedAssetsQuerysetMixin:
|
||||
class UserAllGrantedAssetsQuerysetMixin:
|
||||
only_fields = serializers.AssetGrantedSerializer.Meta.only_fields
|
||||
pagination_class = AllGrantedAssetPagination
|
||||
user: User
|
||||
ordering_fields = ("hostname", "ip", "port", "cpu_cores")
|
||||
ordering = ('hostname', )
|
||||
|
||||
|
||||
user: User
|
||||
|
||||
def get_queryset(self):
|
||||
if getattr(self, 'swagger_fake_view', False):
|
||||
return Asset.objects.none()
|
||||
queryset = UserGrantedAssetsQueryUtils(self.user) \
|
||||
.get_all_granted_assets()
|
||||
queryset = UserGrantedAssetsQueryUtils(self.user).get_all_granted_assets()
|
||||
queryset = queryset.prefetch_related('platform').only(*self.only_fields)
|
||||
return queryset
|
||||
|
||||
|
Reference in New Issue
Block a user