mirror of https://github.com/jumpserver/jumpserver
perf: 查看用户授权
parent
ec0c334acc
commit
b2991362f1
|
@ -57,7 +57,7 @@ class LoginAssetACLAccountsSerializer(serializers.Serializer):
|
|||
class LoginAssetACLSerializer(BulkOrgResourceModelSerializer):
|
||||
users = LoginAssetACLUsersSerializer()
|
||||
assets = LoginAssetACLAssestsSerializer()
|
||||
account = LoginAssetACLAccountsSerializer()
|
||||
accounts = LoginAssetACLAccountsSerializer()
|
||||
reviewers_amount = serializers.IntegerField(read_only=True, source='reviewers.count')
|
||||
action_display = serializers.ReadOnlyField(source='get_action_display', label=_('Action'))
|
||||
|
||||
|
|
|
@ -108,7 +108,6 @@ class AssetSerializer(JMSWritableNestedModelSerializer):
|
|||
instance.nodes.set(nodes_to_set)
|
||||
|
||||
def validate_nodes(self, nodes):
|
||||
print("Nodes: ", nodes)
|
||||
if nodes:
|
||||
return nodes
|
||||
request = self.context.get('request')
|
||||
|
|
|
@ -32,8 +32,8 @@ class UserDirectGrantedAssetsQuerysetMixin:
|
|||
class UserAllGrantedAssetsQuerysetMixin:
|
||||
only_fields = serializers.AssetGrantedSerializer.Meta.only_fields
|
||||
pagination_class = AllGrantedAssetPagination
|
||||
ordering_fields = ("hostname", "address", "port", "cpu_cores")
|
||||
ordering = ('hostname', )
|
||||
ordering_fields = ("name", "address", "port", "cpu_cores")
|
||||
ordering = ('name', )
|
||||
|
||||
user: User
|
||||
|
||||
|
@ -41,7 +41,8 @@ class UserAllGrantedAssetsQuerysetMixin:
|
|||
if getattr(self, 'swagger_fake_view', False):
|
||||
return Asset.objects.none()
|
||||
queryset = UserGrantedAssetsQueryUtils(self.user).get_all_granted_assets()
|
||||
queryset = queryset.prefetch_related('platform').only(*self.only_fields)
|
||||
only_fields = [i for i in self.only_fields if i not in ['protocols']]
|
||||
queryset = queryset.prefetch_related('platform', 'protocols').only(*only_fields)
|
||||
return queryset
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue