Browse Source

perf: Koko can display assets custom name

pull/14249/head
wangruidong 2 months ago committed by Bryan
parent
commit
e95da730f2
  1. 5
      apps/perms/api/user_permission/assets.py

5
apps/perms/api/user_permission/assets.py

@ -56,8 +56,9 @@ class BaseUserPermedAssetsApi(SelfOrPKUserMixin, ExtraFilterFieldsMixin, ListAPI
return assets return assets
def get_serializer(self, *args, **kwargs): def get_serializer(self, *args, **kwargs):
if len(args) == 1 and kwargs.get('many', False) and self.request_user_is_self(): need_custom_value_user = self.request_user_is_self() or self.request.user.is_service_account
MyAsset.set_asset_custom_value(args[0], self.request.user) 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) return super().get_serializer(*args, **kwargs)
@abc.abstractmethod @abc.abstractmethod

Loading…
Cancel
Save