From e95da730f2b23af9f8b43ecaf3ccd08f9558632b Mon Sep 17 00:00:00 2001 From: wangruidong <940853815@qq.com> Date: Mon, 23 Sep 2024 16:47:29 +0800 Subject: [PATCH] perf: Koko can display assets custom name --- apps/perms/api/user_permission/assets.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/perms/api/user_permission/assets.py b/apps/perms/api/user_permission/assets.py index 1e541eb8d..0eac8c87e 100644 --- a/apps/perms/api/user_permission/assets.py +++ b/apps/perms/api/user_permission/assets.py @@ -56,8 +56,9 @@ class BaseUserPermedAssetsApi(SelfOrPKUserMixin, ExtraFilterFieldsMixin, ListAPI return assets def get_serializer(self, *args, **kwargs): - if len(args) == 1 and kwargs.get('many', False) and self.request_user_is_self(): - MyAsset.set_asset_custom_value(args[0], self.request.user) + need_custom_value_user = self.request_user_is_self() or self.request.user.is_service_account + if len(args) == 1 and kwargs.get('many', False) and need_custom_value_user: + MyAsset.set_asset_custom_value(args[0], self.user) return super().get_serializer(*args, **kwargs) @abc.abstractmethod